Stop using GSlice
It has been inofficially deprecated for years, is known to cause issues with valgrind and potentially hides memory corruption. Lets stop using it. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1473
This commit is contained in:
parent
d72da7d246
commit
22f691939c
@ -148,7 +148,7 @@ client_data_free (ClientData *data)
|
||||
{
|
||||
g_signal_handler_disconnect (data->client, data->backend_died_id);
|
||||
g_object_unref (data->client);
|
||||
g_slice_free (ClientData, data);
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -378,7 +378,7 @@ calendar_sources_connect_client_sync (CalendarSources *sources,
|
||||
}
|
||||
else
|
||||
{
|
||||
client_data = g_slice_new0 (ClientData);
|
||||
client_data = g_new0 (ClientData, 1);
|
||||
client_data->client = E_CAL_CLIENT (g_object_ref (client));
|
||||
client_data->backend_died_id = g_signal_connect (client,
|
||||
"backend-died",
|
||||
@ -406,7 +406,7 @@ async_context_free (gpointer ptr)
|
||||
if (ctx)
|
||||
{
|
||||
g_clear_object (&ctx->source);
|
||||
g_slice_free (AsyncContext, ctx);
|
||||
g_free (ctx);
|
||||
}
|
||||
}
|
||||
|
||||
@ -446,7 +446,7 @@ calendar_sources_connect_client (CalendarSources *sources,
|
||||
AsyncContext *ctx;
|
||||
g_autoptr (GTask) task = NULL;
|
||||
|
||||
ctx = g_slice_new0 (AsyncContext);
|
||||
ctx = g_new0 (AsyncContext, 1);
|
||||
ctx->source = g_object_ref (source);
|
||||
ctx->source_type = source_type;
|
||||
ctx->wait_for_connected_seconds = wait_for_connected_seconds;
|
||||
|
@ -507,7 +507,7 @@ gtk_action_muxer_register_observer (GtkActionObservable *observable,
|
||||
|
||||
if (action == NULL)
|
||||
{
|
||||
action = g_slice_new (Action);
|
||||
action = g_new (Action, 1);
|
||||
action->muxer = muxer;
|
||||
action->fullname = g_strdup (name);
|
||||
action->watchers = NULL;
|
||||
@ -545,7 +545,7 @@ gtk_action_muxer_free_group (gpointer data)
|
||||
g_object_unref (group->group);
|
||||
g_free (group->prefix);
|
||||
|
||||
g_slice_free (Group, group);
|
||||
g_free (group);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -560,7 +560,7 @@ gtk_action_muxer_free_action (gpointer data)
|
||||
g_slist_free (action->watchers);
|
||||
g_free (action->fullname);
|
||||
|
||||
g_slice_free (Action, action);
|
||||
g_free (action);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -711,7 +711,7 @@ gtk_action_muxer_insert (GtkActionMuxer *muxer,
|
||||
/* TODO: diff instead of ripout and replace */
|
||||
gtk_action_muxer_remove (muxer, prefix);
|
||||
|
||||
group = g_slice_new (Group);
|
||||
group = g_new (Group, 1);
|
||||
group->muxer = muxer;
|
||||
group->group = g_object_ref (action_group);
|
||||
group->prefix = g_strdup (prefix);
|
||||
|
@ -86,7 +86,7 @@ invocation_data_new (GVariant *params,
|
||||
{
|
||||
InvocationData *ret;
|
||||
|
||||
ret = g_slice_new0 (InvocationData);
|
||||
ret = g_new0 (InvocationData, 1);
|
||||
ret->parameters = g_variant_ref (params);
|
||||
ret->invocation = g_object_ref (invocation);
|
||||
|
||||
@ -99,7 +99,7 @@ invocation_data_free (InvocationData *data)
|
||||
g_variant_unref (data->parameters);
|
||||
g_clear_object (&data->invocation);
|
||||
|
||||
g_slice_free (InvocationData, data);
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -58,7 +58,7 @@ cache_state_free (CacheState *state)
|
||||
{
|
||||
g_clear_pointer (&state->folders, g_hash_table_unref);
|
||||
g_list_free_full (state->app_infos, g_object_unref);
|
||||
g_slice_free (CacheState, state);
|
||||
g_free (state);
|
||||
}
|
||||
|
||||
static CacheState *
|
||||
@ -66,7 +66,7 @@ cache_state_new (void)
|
||||
{
|
||||
CacheState *state;
|
||||
|
||||
state = g_slice_new0 (CacheState);
|
||||
state = g_new0 (CacheState, 1);
|
||||
state->folders = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
|
||||
|
||||
return g_steal_pointer (&state);
|
||||
|
@ -1453,7 +1453,7 @@ create_running_state (ShellApp *app)
|
||||
|
||||
g_assert (app->running_state == NULL);
|
||||
|
||||
app->running_state = g_slice_new0 (ShellAppRunningState);
|
||||
app->running_state = g_new0 (ShellAppRunningState, 1);
|
||||
app->running_state->refcount = 1;
|
||||
app->running_state->workspace_switch_id =
|
||||
g_signal_connect (workspace_manager, "workspace-switched",
|
||||
@ -1527,7 +1527,7 @@ unref_running_state (ShellAppRunningState *state)
|
||||
g_clear_object (&state->session);
|
||||
g_clear_pointer (&state->unique_bus_name, g_free);
|
||||
|
||||
g_slice_free (ShellAppRunningState, state);
|
||||
g_free (state);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1581,7 +1581,7 @@ run_leisure_functions (gpointer data)
|
||||
if (closure->notify)
|
||||
closure->notify (closure->user_data);
|
||||
|
||||
g_slice_free (LeisureClosure, closure);
|
||||
g_free (closure);
|
||||
}
|
||||
|
||||
g_slist_free (closures);
|
||||
@ -1670,7 +1670,7 @@ shell_global_run_at_leisure (ShellGlobal *global,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
LeisureClosure *closure = g_slice_new (LeisureClosure);
|
||||
LeisureClosure *closure = g_new (LeisureClosure, 1);
|
||||
closure->func = func;
|
||||
closure->user_data = user_data;
|
||||
closure->notify = notify;
|
||||
|
@ -81,7 +81,7 @@ shell_agent_request_free (gpointer data)
|
||||
g_strfreev (request->hints);
|
||||
g_clear_pointer (&request->entries, g_variant_dict_unref);
|
||||
|
||||
g_slice_free (ShellAgentRequest, request);
|
||||
g_free (request);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -360,7 +360,7 @@ shell_network_agent_get_secrets (NMSecretAgentOld *agent,
|
||||
shell_agent_request_cancel (request);
|
||||
}
|
||||
|
||||
request = g_slice_new0 (ShellAgentRequest);
|
||||
request = g_new0 (ShellAgentRequest, 1);
|
||||
request->self = g_object_ref (self);
|
||||
request->cancellable = g_cancellable_new ();
|
||||
request->connection = g_object_ref (connection);
|
||||
@ -617,7 +617,7 @@ keyring_request_free (KeyringRequest *r)
|
||||
g_object_unref (r->self);
|
||||
g_object_unref (r->connection);
|
||||
|
||||
g_slice_free (KeyringRequest, r);
|
||||
g_free (r);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -765,7 +765,7 @@ shell_network_agent_save_secrets (NMSecretAgentOld *agent,
|
||||
{
|
||||
KeyringRequest *r;
|
||||
|
||||
r = g_slice_new (KeyringRequest);
|
||||
r = g_new (KeyringRequest, 1);
|
||||
r->n_secrets = 0;
|
||||
r->self = g_object_ref (agent);
|
||||
r->connection = g_object_ref (connection);
|
||||
@ -812,7 +812,7 @@ shell_network_agent_delete_secrets (NMSecretAgentOld *agent,
|
||||
NMSettingConnection *s_con;
|
||||
const gchar *uuid;
|
||||
|
||||
r = g_slice_new (KeyringRequest);
|
||||
r = g_new (KeyringRequest, 1);
|
||||
r->n_secrets = 0; /* ignored by delete secrets calls */
|
||||
r->self = g_object_ref (agent);
|
||||
r->connection = g_object_ref (connection);
|
||||
|
@ -259,7 +259,7 @@ define_event (ShellPerfLog *perf_log,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
event = g_slice_new (ShellPerfEvent);
|
||||
event = g_new (ShellPerfEvent, 1);
|
||||
|
||||
event->id = perf_log->events->len;
|
||||
event->name = g_strdup (name);
|
||||
@ -501,7 +501,7 @@ shell_perf_log_define_statistic (ShellPerfLog *perf_log,
|
||||
if (event == NULL)
|
||||
return;
|
||||
|
||||
statistic = g_slice_new (ShellPerfStatistic);
|
||||
statistic = g_new (ShellPerfStatistic, 1);
|
||||
statistic->event = event;
|
||||
|
||||
statistic->initialized = FALSE;
|
||||
@ -598,7 +598,7 @@ shell_perf_log_add_statistics_callback (ShellPerfLog *perf_log,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
ShellPerfStatisticsClosure *closure = g_slice_new (ShellPerfStatisticsClosure);
|
||||
ShellPerfStatisticsClosure *closure = g_new (ShellPerfStatisticsClosure, 1);
|
||||
|
||||
closure->callback = callback;
|
||||
closure->user_data = user_data;
|
||||
|
@ -76,7 +76,7 @@ free_tray_icon (gpointer data)
|
||||
0, 0, NULL, NULL, child);
|
||||
g_object_unref (child->actor);
|
||||
}
|
||||
g_slice_free (ShellTrayManagerChild, child);
|
||||
g_free (child);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -337,7 +337,7 @@ na_tray_icon_added (NaTrayManager *na_manager, GtkWidget *socket,
|
||||
* the window we put it in match that as well */
|
||||
gtk_widget_set_visual (win, gtk_widget_get_visual (socket));
|
||||
|
||||
child = g_slice_new0 (ShellTrayManagerChild);
|
||||
child = g_new0 (ShellTrayManagerChild, 1);
|
||||
child->manager = manager;
|
||||
child->window = win;
|
||||
child->socket = socket;
|
||||
|
@ -33,7 +33,7 @@ st_icon_colors_new (void)
|
||||
{
|
||||
StIconColors *colors;
|
||||
|
||||
colors = g_slice_new0 (StIconColors);
|
||||
colors = g_new0 (StIconColors, 1);
|
||||
colors->ref_count = 1;
|
||||
|
||||
return colors;
|
||||
@ -72,7 +72,7 @@ st_icon_colors_unref (StIconColors *colors)
|
||||
g_return_if_fail (colors->ref_count > 0);
|
||||
|
||||
if (g_atomic_int_dec_and_test ((volatile int *)&colors->ref_count))
|
||||
g_slice_free (StIconColors, colors);
|
||||
g_free (colors);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,7 +59,7 @@ st_shadow_new (ClutterColor *color,
|
||||
{
|
||||
StShadow *shadow;
|
||||
|
||||
shadow = g_slice_new (StShadow);
|
||||
shadow = g_new (StShadow, 1);
|
||||
|
||||
shadow->color = *color;
|
||||
shadow->xoffset = xoffset;
|
||||
@ -105,7 +105,7 @@ st_shadow_unref (StShadow *shadow)
|
||||
g_return_if_fail (shadow->ref_count > 0);
|
||||
|
||||
if (g_atomic_int_dec_and_test (&shadow->ref_count))
|
||||
g_slice_free (StShadow, shadow);
|
||||
g_free (shadow);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -210,7 +210,7 @@ st_shadow_helper_new (StShadow *shadow)
|
||||
{
|
||||
StShadowHelper *helper;
|
||||
|
||||
helper = g_slice_new0 (StShadowHelper);
|
||||
helper = g_new0 (StShadowHelper, 1);
|
||||
helper->shadow = st_shadow_ref (shadow);
|
||||
|
||||
return helper;
|
||||
@ -255,7 +255,7 @@ st_shadow_helper_copy (StShadowHelper *helper)
|
||||
{
|
||||
StShadowHelper *copy;
|
||||
|
||||
copy = g_slice_new (StShadowHelper);
|
||||
copy = g_new (StShadowHelper, 1);
|
||||
*copy = *helper;
|
||||
if (copy->pipeline)
|
||||
cogl_object_ref (copy->pipeline);
|
||||
@ -277,7 +277,7 @@ st_shadow_helper_free (StShadowHelper *helper)
|
||||
cogl_object_unref (helper->pipeline);
|
||||
st_shadow_unref (helper->shadow);
|
||||
|
||||
g_slice_free (StShadowHelper, helper);
|
||||
g_free (helper);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -353,7 +353,7 @@ texture_load_data_free (gpointer p)
|
||||
if (data->actors)
|
||||
g_slist_free_full (data->actors, (GDestroyNotify) g_object_unref);
|
||||
|
||||
g_slice_free (AsyncTextureLoadData, data);
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -807,7 +807,7 @@ st_texture_cache_free_bind (gpointer data)
|
||||
StTextureCachePropertyBind *bind = data;
|
||||
if (bind->weakref_active)
|
||||
g_object_weak_unref (G_OBJECT (bind->image), st_texture_cache_bind_weak_notify, bind);
|
||||
g_slice_free (StTextureCachePropertyBind, bind);
|
||||
g_free (bind);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -833,7 +833,7 @@ st_texture_cache_bind_cairo_surface_property (StTextureCache *cache,
|
||||
gchar *notify_key;
|
||||
StTextureCachePropertyBind *bind;
|
||||
|
||||
bind = g_slice_new0 (StTextureCachePropertyBind);
|
||||
bind = g_new0 (StTextureCachePropertyBind, 1);
|
||||
bind->cache = cache;
|
||||
bind->source = object;
|
||||
|
||||
@ -930,7 +930,7 @@ ensure_request (StTextureCache *cache,
|
||||
if (pending == NULL)
|
||||
{
|
||||
/* Not cached and no pending request, create it */
|
||||
*request = g_slice_new0 (AsyncTextureLoadData);
|
||||
*request = g_new0 (AsyncTextureLoadData, 1);
|
||||
if (policy != ST_TEXTURE_CACHE_POLICY_NONE)
|
||||
g_hash_table_insert (cache->priv->outstanding_requests, g_strdup (key), *request);
|
||||
}
|
||||
@ -1192,7 +1192,7 @@ on_data_destroy (gpointer data)
|
||||
g_object_unref (d->gfile);
|
||||
g_object_unref (d->actor);
|
||||
g_object_unref (d->cancellable);
|
||||
g_slice_free (AsyncImageData, d);
|
||||
g_free (d);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1357,7 +1357,7 @@ st_texture_cache_load_sliced_image (StTextureCache *cache,
|
||||
g_assert (paint_scale > 0);
|
||||
g_assert (resource_scale > 0);
|
||||
|
||||
data = g_slice_new0 (AsyncImageData);
|
||||
data = g_new0 (AsyncImageData, 1);
|
||||
data->grid_width = grid_width;
|
||||
data->grid_height = grid_height;
|
||||
data->paint_scale = paint_scale;
|
||||
|
Loading…
Reference in New Issue
Block a user