clutter: 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.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1512>
This commit is contained in:
Robert Mader 2020-10-19 19:57:45 +02:00
parent df4508e8cf
commit 8b977e9046
21 changed files with 81 additions and 81 deletions

View File

@ -1090,7 +1090,7 @@ cally_actor_add_action_full (CallyActor *cally_actor,
priv = cally_actor->priv; priv = cally_actor->priv;
info = g_slice_new (CallyActorActionInfo); info = g_new0 (CallyActorActionInfo, 1);
info->name = g_strdup (action_name); info->name = g_strdup (action_name);
info->description = g_strdup (action_description); info->description = g_strdup (action_description);
info->keybinding = g_strdup (action_keybinding); info->keybinding = g_strdup (action_keybinding);
@ -1195,5 +1195,5 @@ _cally_actor_destroy_action_info (gpointer action_info,
if (info->notify) if (info->notify)
info->notify (info->user_data); info->notify (info->user_data);
g_slice_free (CallyActorActionInfo, info); g_free (info);
} }

View File

@ -54,7 +54,7 @@ clutter_actor_box_new (gfloat x_1,
ClutterActorBox * ClutterActorBox *
clutter_actor_box_alloc (void) clutter_actor_box_alloc (void)
{ {
return g_slice_new0 (ClutterActorBox); return g_new0 (ClutterActorBox, 1);
} }
/** /**
@ -130,7 +130,7 @@ ClutterActorBox *
clutter_actor_box_copy (const ClutterActorBox *box) clutter_actor_box_copy (const ClutterActorBox *box)
{ {
if (G_LIKELY (box != NULL)) if (G_LIKELY (box != NULL))
return g_slice_dup (ClutterActorBox, box); return g_memdup2 (box, sizeof (ClutterActorBox));
return NULL; return NULL;
} }
@ -148,7 +148,7 @@ void
clutter_actor_box_free (ClutterActorBox *box) clutter_actor_box_free (ClutterActorBox *box)
{ {
if (G_LIKELY (box != NULL)) if (G_LIKELY (box != NULL))
g_slice_free (ClutterActorBox, box); g_free (box);
} }
/** /**

View File

@ -4341,7 +4341,7 @@ static void
clutter_transform_info_free (gpointer data) clutter_transform_info_free (gpointer data)
{ {
if (data != NULL) if (data != NULL)
g_slice_free (ClutterTransformInfo, data); g_free (data);
} }
/*< private > /*< private >
@ -4369,7 +4369,7 @@ _clutter_actor_get_transform_info (ClutterActor *self)
info = g_object_get_qdata (G_OBJECT (self), quark_actor_transform_info); info = g_object_get_qdata (G_OBJECT (self), quark_actor_transform_info);
if (info == NULL) if (info == NULL)
{ {
info = g_slice_new (ClutterTransformInfo); info = g_new0 (ClutterTransformInfo, 1);
*info = *get_default_transform_info (); *info = *get_default_transform_info ();
@ -12791,7 +12791,7 @@ clutter_actor_parse_custom_node (ClutterScriptable *scriptable,
{ {
RotationInfo *info; RotationInfo *info;
info = g_slice_new0 (RotationInfo); info = g_new0 (RotationInfo, 1);
retval = parse_rotation (actor, node, info); retval = parse_rotation (actor, node, info);
if (retval) if (retval)
@ -12800,7 +12800,7 @@ clutter_actor_parse_custom_node (ClutterScriptable *scriptable,
g_value_set_pointer (value, info); g_value_set_pointer (value, info);
} }
else else
g_slice_free (RotationInfo, info); g_free (info);
} }
else if (strcmp (name, "actions") == 0 || else if (strcmp (name, "actions") == 0 ||
strcmp (name, "constraints") == 0 || strcmp (name, "constraints") == 0 ||
@ -12863,7 +12863,7 @@ clutter_actor_set_custom_property (ClutterScriptable *scriptable,
clutter_actor_set_rotation_angle (actor, info->axis, info->angle); clutter_actor_set_rotation_angle (actor, info->axis, info->angle);
g_slice_free (RotationInfo, info); g_free (info);
return; return;
} }
@ -16429,7 +16429,7 @@ static void
layout_info_free (gpointer data) layout_info_free (gpointer data)
{ {
if (G_LIKELY (data != NULL)) if (G_LIKELY (data != NULL))
g_slice_free (ClutterLayoutInfo, data); g_free (data);
} }
/*< private > /*< private >
@ -16472,7 +16472,7 @@ _clutter_actor_get_layout_info (ClutterActor *self)
retval = _clutter_actor_peek_layout_info (self); retval = _clutter_actor_peek_layout_info (self);
if (retval == NULL) if (retval == NULL)
{ {
retval = g_slice_new (ClutterLayoutInfo); retval = g_new0 (ClutterLayoutInfo, 1);
*retval = default_layout_info; *retval = default_layout_info;
@ -17316,7 +17316,7 @@ clutter_animation_info_free (gpointer data)
if (info->states != NULL) if (info->states != NULL)
g_array_unref (info->states); g_array_unref (info->states);
g_slice_free (ClutterAnimationInfo, info); g_free (info);
} }
} }
@ -17342,7 +17342,7 @@ _clutter_actor_get_animation_info (ClutterActor *self)
res = g_object_get_qdata (obj, quark_actor_animation_info); res = g_object_get_qdata (obj, quark_actor_animation_info);
if (res == NULL) if (res == NULL)
{ {
res = g_slice_new (ClutterAnimationInfo); res = g_new0 (ClutterAnimationInfo, 1);
*res = default_animation_info; *res = default_animation_info;
@ -17380,7 +17380,7 @@ transition_closure_free (gpointer data)
g_free (clos->name); g_free (clos->name);
g_slice_free (TransitionClosure, clos); g_free (clos);
} }
} }
@ -17471,7 +17471,7 @@ clutter_actor_add_transition_internal (ClutterActor *self,
timeline = CLUTTER_TIMELINE (transition); timeline = CLUTTER_TIMELINE (transition);
clos = g_slice_new (TransitionClosure); clos = g_new0 (TransitionClosure, 1);
clos->actor = self; clos->actor = self;
clos->transition = g_object_ref (transition); clos->transition = g_object_ref (transition);
clos->name = g_strdup (name); clos->name = g_strdup (name);
@ -19310,7 +19310,7 @@ bind_closure_free (gpointer data_)
return; return;
g_array_unref (data->props); g_array_unref (data->props);
g_slice_free (BindClosure, data); g_free (data);
} }
static ClutterActor * static ClutterActor *
@ -19401,7 +19401,7 @@ clutter_actor_bind_model_with_properties (ClutterActor *self,
g_return_if_fail (G_IS_LIST_MODEL (model)); g_return_if_fail (G_IS_LIST_MODEL (model));
g_return_if_fail (g_type_is_a (child_type, CLUTTER_TYPE_ACTOR)); g_return_if_fail (g_type_is_a (child_type, CLUTTER_TYPE_ACTOR));
clos = g_slice_new0 (BindClosure); clos = g_new0 (BindClosure, 1);
clos->child_type = child_type; clos->child_type = child_type;
clos->props = g_array_new (FALSE, FALSE, sizeof (BindProperty)); clos->props = g_array_new (FALSE, FALSE, sizeof (BindProperty));

View File

@ -59,7 +59,7 @@
ClutterMargin * ClutterMargin *
clutter_margin_new (void) clutter_margin_new (void)
{ {
return g_slice_new0 (ClutterMargin); return g_new0 (ClutterMargin, 1);
} }
/** /**
@ -77,7 +77,7 @@ ClutterMargin *
clutter_margin_copy (const ClutterMargin *margin_) clutter_margin_copy (const ClutterMargin *margin_)
{ {
if (G_LIKELY (margin_ != NULL)) if (G_LIKELY (margin_ != NULL))
return g_slice_dup (ClutterMargin, margin_); return g_memdup2 (margin_, sizeof (ClutterMargin));
return NULL; return NULL;
} }
@ -95,7 +95,7 @@ void
clutter_margin_free (ClutterMargin *margin_) clutter_margin_free (ClutterMargin *margin_)
{ {
if (G_LIKELY (margin_ != NULL)) if (G_LIKELY (margin_ != NULL))
g_slice_free (ClutterMargin, margin_); g_free (margin_);
} }
G_DEFINE_BOXED_TYPE (ClutterMargin, clutter_margin, G_DEFINE_BOXED_TYPE (ClutterMargin, clutter_margin,

View File

@ -104,7 +104,7 @@ struct _ClutterBezier
ClutterBezier * ClutterBezier *
_clutter_bezier_new (void) _clutter_bezier_new (void)
{ {
return g_slice_new0 (ClutterBezier); return g_new0 (ClutterBezier, 1);
} }
void void
@ -112,7 +112,7 @@ _clutter_bezier_free (ClutterBezier * b)
{ {
if (G_LIKELY (b)) if (G_LIKELY (b))
{ {
g_slice_free (ClutterBezier, b); g_free (b);
} }
} }

View File

@ -189,7 +189,7 @@ binding_entry_new (const gchar *name,
modifiers = modifiers & BINDING_MOD_MASK; modifiers = modifiers & BINDING_MOD_MASK;
entry = g_slice_new (ClutterBindingEntry); entry = g_new0 (ClutterBindingEntry, 1);
entry->key_val = key_val; entry->key_val = key_val;
entry->modifiers = modifiers; entry->modifiers = modifiers;
entry->name = (gchar *) g_intern_string (name); entry->name = (gchar *) g_intern_string (name);
@ -221,7 +221,7 @@ binding_entry_free (gpointer data)
g_closure_unref (entry->closure); g_closure_unref (entry->closure);
g_slice_free (ClutterBindingEntry, entry); g_free (entry);
} }
} }

View File

@ -911,7 +911,7 @@ ClutterColor *
clutter_color_copy (const ClutterColor *color) clutter_color_copy (const ClutterColor *color)
{ {
if (G_LIKELY (color != NULL)) if (G_LIKELY (color != NULL))
return g_slice_dup (ClutterColor, color); return g_memdup2 (color, sizeof (ClutterColor));
return NULL; return NULL;
} }
@ -928,7 +928,7 @@ void
clutter_color_free (ClutterColor *color) clutter_color_free (ClutterColor *color)
{ {
if (G_LIKELY (color != NULL)) if (G_LIKELY (color != NULL))
g_slice_free (ClutterColor, color); g_free (color);
} }
/** /**
@ -977,7 +977,7 @@ clutter_color_new (guint8 red,
ClutterColor * ClutterColor *
clutter_color_alloc (void) clutter_color_alloc (void)
{ {
return g_slice_new0 (ClutterColor); return g_new0 (ClutterColor, 1);
} }
/** /**

View File

@ -1269,7 +1269,7 @@ clutter_event_new (ClutterEventType type)
ClutterEvent *new_event; ClutterEvent *new_event;
ClutterEventPrivate *priv; ClutterEventPrivate *priv;
priv = g_slice_new0 (ClutterEventPrivate); priv = g_new0 (ClutterEventPrivate, 1);
new_event = (ClutterEvent *) priv; new_event = (ClutterEvent *) priv;
new_event->type = new_event->any.type = type; new_event->type = new_event->any.type = type;
@ -1415,7 +1415,7 @@ clutter_event_free (ClutterEvent *event)
break; break;
} }
g_slice_free (ClutterEventPrivate, (ClutterEventPrivate *) event); g_free ((ClutterEventPrivate *) event);
} }
} }
@ -1830,7 +1830,7 @@ clutter_event_add_filter (ClutterStage *stage,
gpointer user_data) gpointer user_data)
{ {
ClutterMainContext *context = _clutter_context_get_default (); ClutterMainContext *context = _clutter_context_get_default ();
ClutterEventFilter *event_filter = g_slice_new (ClutterEventFilter); ClutterEventFilter *event_filter = g_new0 (ClutterEventFilter, 1);
static guint event_filter_id = 0; static guint event_filter_id = 0;
event_filter->stage = stage; event_filter->stage = stage;
@ -1871,7 +1871,7 @@ clutter_event_remove_filter (guint id)
event_filter->notify (event_filter->user_data); event_filter->notify (event_filter->user_data);
context->event_filters = g_list_delete_link (context->event_filters, l); context->event_filters = g_list_delete_link (context->event_filters, l);
g_slice_free (ClutterEventFilter, event_filter); g_free (event_filter);
return; return;
} }
} }

View File

@ -44,7 +44,7 @@ _clutter_id_pool_new (guint initial_size)
{ {
ClutterIDPool *self; ClutterIDPool *self;
self = g_slice_new (ClutterIDPool); self = g_new0 (ClutterIDPool, 1);
self->array = g_array_sized_new (FALSE, FALSE, self->array = g_array_sized_new (FALSE, FALSE,
sizeof (gpointer), initial_size); sizeof (gpointer), initial_size);
@ -59,7 +59,7 @@ _clutter_id_pool_free (ClutterIDPool *id_pool)
g_array_free (id_pool->array, TRUE); g_array_free (id_pool->array, TRUE);
g_slist_free (id_pool->free_ids); g_slist_free (id_pool->free_ids);
g_slice_free (ClutterIDPool, id_pool); g_free (id_pool);
} }
guint32 guint32

View File

@ -263,7 +263,7 @@ _clutter_threads_dispatch_free (gpointer data)
if (dispatch->notify) if (dispatch->notify)
dispatch->notify (dispatch->data); dispatch->notify (dispatch->data);
g_slice_free (ClutterThreadsDispatch, dispatch); g_free (dispatch);
} }
/** /**
@ -363,7 +363,7 @@ clutter_threads_add_idle_full (gint priority,
g_return_val_if_fail (func != NULL, 0); g_return_val_if_fail (func != NULL, 0);
dispatch = g_slice_new (ClutterThreadsDispatch); dispatch = g_new0 (ClutterThreadsDispatch, 1);
dispatch->func = func; dispatch->func = func;
dispatch->data = data; dispatch->data = data;
dispatch->notify = notify; dispatch->notify = notify;
@ -434,7 +434,7 @@ clutter_threads_add_timeout_full (gint priority,
g_return_val_if_fail (func != NULL, 0); g_return_val_if_fail (func != NULL, 0);
dispatch = g_slice_new (ClutterThreadsDispatch); dispatch = g_new0 (ClutterThreadsDispatch, 1);
dispatch->func = func; dispatch->func = func;
dispatch->data = data; dispatch->data = data;
dispatch->notify = notify; dispatch->notify = notify;
@ -2007,7 +2007,7 @@ clutter_threads_remove_repaint_func (guint handle_id)
if (repaint_func->notify) if (repaint_func->notify)
repaint_func->notify (repaint_func->data); repaint_func->notify (repaint_func->data);
g_slice_free (ClutterRepaintFunction, repaint_func); g_free (repaint_func);
break; break;
} }
@ -2114,7 +2114,7 @@ clutter_threads_add_repaint_func_full (ClutterRepaintFlags flags,
context = _clutter_context_get_default (); context = _clutter_context_get_default ();
repaint_func = g_slice_new (ClutterRepaintFunction); repaint_func = g_new0 (ClutterRepaintFunction, 1);
repaint_func->id = context->last_repaint_id++; repaint_func->id = context->last_repaint_id++;
@ -2178,7 +2178,7 @@ _clutter_run_repaint_functions (ClutterRepaintFlags flags)
if (repaint_func->notify != NULL) if (repaint_func->notify != NULL)
repaint_func->notify (repaint_func->data); repaint_func->notify (repaint_func->data);
g_slice_free (ClutterRepaintFunction, repaint_func); g_free (repaint_func);
} }
} }

View File

@ -62,7 +62,7 @@ struct _ClutterPaintVolume
/* As an optimization for internally managed PaintVolumes we allow /* As an optimization for internally managed PaintVolumes we allow
* initializing ClutterPaintVolume variables allocated on the stack * initializing ClutterPaintVolume variables allocated on the stack
* so we can avoid hammering the slice allocator. */ * so we can avoid hammering the memory allocator. */
guint is_static:1; guint is_static:1;
/* A newly initialized PaintVolume is considered empty as it is /* A newly initialized PaintVolume is considered empty as it is

View File

@ -59,7 +59,7 @@ _clutter_paint_volume_new (ClutterActor *actor)
g_return_val_if_fail (actor != NULL, NULL); g_return_val_if_fail (actor != NULL, NULL);
pv = g_slice_new (ClutterPaintVolume); pv = g_new0 (ClutterPaintVolume, 1);
pv->actor = actor; pv->actor = actor;
@ -78,7 +78,7 @@ _clutter_paint_volume_new (ClutterActor *actor)
* traversal of a Clutter scene graph and since paint volumes often * traversal of a Clutter scene graph and since paint volumes often
* have a very short life cycle that maps well to stack allocation we * have a very short life cycle that maps well to stack allocation we
* allow initializing a static ClutterPaintVolume variable to avoid * allow initializing a static ClutterPaintVolume variable to avoid
* hammering the slice allocator. * hammering the memory allocator.
* *
* We were seeing slice allocation take about 1% cumulative CPU time * We were seeing slice allocation take about 1% cumulative CPU time
* for some very simple clutter tests which although it isn't a *lot* * for some very simple clutter tests which although it isn't a *lot*
@ -133,7 +133,7 @@ clutter_paint_volume_copy (const ClutterPaintVolume *pv)
g_return_val_if_fail (pv != NULL, NULL); g_return_val_if_fail (pv != NULL, NULL);
copy = g_slice_dup (ClutterPaintVolume, pv); copy = g_memdup2 (pv, sizeof (ClutterPaintVolume));
copy->is_static = FALSE; copy->is_static = FALSE;
return copy; return copy;
@ -164,7 +164,7 @@ clutter_paint_volume_free (ClutterPaintVolume *pv)
if (G_LIKELY (pv->is_static)) if (G_LIKELY (pv->is_static))
return; return;
g_slice_free (ClutterPaintVolume, pv); g_free (pv);
} }
/** /**

View File

@ -1446,7 +1446,7 @@ clutter_path_get_length (ClutterPath *path)
static ClutterPathNodeFull * static ClutterPathNodeFull *
clutter_path_node_full_new (void) clutter_path_node_full_new (void)
{ {
return g_slice_new0 (ClutterPathNodeFull); return g_new0 (ClutterPathNodeFull, 1);
} }
static void static void
@ -1455,7 +1455,7 @@ clutter_path_node_full_free (ClutterPathNodeFull *node)
if (node->bezier) if (node->bezier)
_clutter_bezier_free (node->bezier); _clutter_bezier_free (node->bezier);
g_slice_free (ClutterPathNodeFull, node); g_free (node);
} }
/** /**
@ -1471,7 +1471,7 @@ clutter_path_node_full_free (ClutterPathNodeFull *node)
ClutterPathNode * ClutterPathNode *
clutter_path_node_copy (const ClutterPathNode *node) clutter_path_node_copy (const ClutterPathNode *node)
{ {
return g_slice_dup (ClutterPathNode, node); return g_memdup2 (node, sizeof (ClutterPathNode));
} }
/** /**
@ -1486,7 +1486,7 @@ void
clutter_path_node_free (ClutterPathNode *node) clutter_path_node_free (ClutterPathNode *node)
{ {
if (G_LIKELY (node)) if (G_LIKELY (node))
g_slice_free (ClutterPathNode, node); g_free (node);
} }
/** /**
@ -1550,7 +1550,7 @@ clutter_knot_copy (const ClutterKnot *knot)
if (G_UNLIKELY (knot == NULL)) if (G_UNLIKELY (knot == NULL))
return NULL; return NULL;
return g_slice_dup (ClutterKnot, knot); return g_memdup2 (knot, sizeof (ClutterKnot));
} }
/** /**
@ -1565,7 +1565,7 @@ void
clutter_knot_free (ClutterKnot *knot) clutter_knot_free (ClutterKnot *knot)
{ {
if (G_LIKELY (knot != NULL)) if (G_LIKELY (knot != NULL))
g_slice_free (ClutterKnot, knot); g_free (knot);
} }
/** /**

View File

@ -733,7 +733,7 @@ parse_signals (ClutterScript *script,
state != NULL ? state : "<default>", target, state != NULL ? state : "<default>", target,
warp_to ? "true" : "false"); warp_to ? "true" : "false");
sinfo = g_slice_new0 (SignalInfo); sinfo = g_new0 (SignalInfo, 1);
sinfo->is_handler = FALSE; sinfo->is_handler = FALSE;
sinfo->name = g_strdup (name); sinfo->name = g_strdup (name);
sinfo->state = g_strdup (state); sinfo->state = g_strdup (state);
@ -780,7 +780,7 @@ parse_signals (ClutterScript *script,
name, name,
handler, connect, flags); handler, connect, flags);
sinfo = g_slice_new0 (SignalInfo); sinfo = g_new0 (SignalInfo, 1);
sinfo->is_handler = TRUE; sinfo->is_handler = TRUE;
sinfo->name = g_strdup (name); sinfo->name = g_strdup (name);
sinfo->handler = g_strdup (handler); sinfo->handler = g_strdup (handler);
@ -852,7 +852,7 @@ clutter_script_parser_object_end (JsonParser *json_parser,
{ {
const gchar *class_name; const gchar *class_name;
oinfo = g_slice_new0 (ObjectInfo); oinfo = g_new0 (ObjectInfo, 1);
oinfo->merge_id = _clutter_script_get_last_merge_id (script); oinfo->merge_id = _clutter_script_get_last_merge_id (script);
oinfo->id = g_strdup (id_); oinfo->id = g_strdup (id_);
oinfo->has_unresolved = TRUE; oinfo->has_unresolved = TRUE;
@ -938,7 +938,7 @@ clutter_script_parser_object_end (JsonParser *json_parser,
continue; continue;
} }
pinfo = g_slice_new (PropertyInfo); pinfo = g_new0 (PropertyInfo, 1);
pinfo->name = g_strdup (name); pinfo->name = g_strdup (name);
pinfo->node = json_node_copy (node); pinfo->node = json_node_copy (node);

View File

@ -203,7 +203,7 @@ property_info_free (gpointer data)
g_free (pinfo->name); g_free (pinfo->name);
g_slice_free (PropertyInfo, pinfo); g_free (pinfo);
} }
} }
@ -219,7 +219,7 @@ signal_info_free (gpointer data)
g_free (sinfo->object); g_free (sinfo->object);
g_free (sinfo->target); g_free (sinfo->target);
g_slice_free (SignalInfo, sinfo); g_free (sinfo);
} }
} }
@ -258,7 +258,7 @@ object_info_free (gpointer data)
oinfo->object = NULL; oinfo->object = NULL;
} }
g_slice_free (ObjectInfo, oinfo); g_free (oinfo);
} }
} }

View File

@ -567,7 +567,7 @@ shader_uniform_free (gpointer data)
g_value_unset (&uniform->value); g_value_unset (&uniform->value);
g_free (uniform->name); g_free (uniform->name);
g_slice_free (ShaderUniform, uniform); g_free (uniform);
} }
} }
@ -577,7 +577,7 @@ shader_uniform_new (const gchar *name,
{ {
ShaderUniform *retval; ShaderUniform *retval;
retval = g_slice_new0 (ShaderUniform); retval = g_new0 (ShaderUniform, 1);
retval->name = g_strdup (name); retval->name = g_strdup (name);
retval->type = G_VALUE_TYPE (value); retval->type = G_VALUE_TYPE (value);
retval->location = -1; retval->location = -1;

View File

@ -106,13 +106,13 @@ clutter_value_peek_pointer (const GValue *value)
static void static void
clutter_value_init_shader_float (GValue *value) clutter_value_init_shader_float (GValue *value)
{ {
value->data[0].v_pointer = g_slice_new0 (ClutterShaderFloat); value->data[0].v_pointer = g_new0 (ClutterShaderFloat, 1);
} }
static void static void
clutter_value_free_shader_float (GValue *value) clutter_value_free_shader_float (GValue *value)
{ {
g_slice_free (ClutterShaderFloat, value->data[0].v_pointer); g_free (value->data[0].v_pointer);
} }
static void static void
@ -120,7 +120,7 @@ clutter_value_copy_shader_float (const GValue *src,
GValue *dest) GValue *dest)
{ {
dest->data[0].v_pointer = dest->data[0].v_pointer =
g_slice_dup (ClutterShaderFloat, src->data[0].v_pointer); g_memdup2 (src->data[0].v_pointer, sizeof (ClutterShaderFloat));
} }
static gchar * static gchar *
@ -198,13 +198,13 @@ clutter_shader_float_get_type (void)
static void static void
clutter_value_init_shader_int (GValue *value) clutter_value_init_shader_int (GValue *value)
{ {
value->data[0].v_pointer = g_slice_new0 (ClutterShaderInt); value->data[0].v_pointer = g_new0 (ClutterShaderInt, 1);
} }
static void static void
clutter_value_free_shader_int (GValue *value) clutter_value_free_shader_int (GValue *value)
{ {
g_slice_free (ClutterShaderInt, value->data[0].v_pointer); g_free (value->data[0].v_pointer);
} }
static void static void
@ -212,7 +212,7 @@ clutter_value_copy_shader_int (const GValue *src,
GValue *dest) GValue *dest)
{ {
dest->data[0].v_pointer = dest->data[0].v_pointer =
g_slice_dup (ClutterShaderInt, src->data[0].v_pointer); g_memdup2 (src->data[0].v_pointer, sizeof (ClutterShaderInt));
} }
static gchar * static gchar *
@ -289,13 +289,13 @@ clutter_shader_int_get_type (void)
static void static void
clutter_value_init_shader_matrix (GValue *value) clutter_value_init_shader_matrix (GValue *value)
{ {
value->data[0].v_pointer = g_slice_new0 (ClutterShaderMatrix); value->data[0].v_pointer = g_new0 (ClutterShaderMatrix, 1);
} }
static void static void
clutter_value_free_shader_matrix (GValue *value) clutter_value_free_shader_matrix (GValue *value)
{ {
g_slice_free (ClutterShaderMatrix, value->data[0].v_pointer); g_free (value->data[0].v_pointer);
} }
static void static void
@ -303,7 +303,7 @@ clutter_value_copy_shader_matrix (const GValue *src,
GValue *dest) GValue *dest)
{ {
dest->data[0].v_pointer = dest->data[0].v_pointer =
g_slice_dup (ClutterShaderMatrix, src->data[0].v_pointer); g_memdup2 (src->data[0].v_pointer, sizeof (ClutterShaderMatrix));
} }
static gchar * static gchar *

View File

@ -2118,7 +2118,7 @@ static gpointer
clutter_perspective_copy (gpointer data) clutter_perspective_copy (gpointer data)
{ {
if (G_LIKELY (data)) if (G_LIKELY (data))
return g_slice_dup (ClutterPerspective, data); return g_memdup2 (data, sizeof (ClutterPerspective));
return NULL; return NULL;
} }
@ -2127,7 +2127,7 @@ static void
clutter_perspective_free (gpointer data) clutter_perspective_free (gpointer data)
{ {
if (G_LIKELY (data)) if (G_LIKELY (data))
g_slice_free (ClutterPerspective, data); g_free (data);
} }
G_DEFINE_BOXED_TYPE (ClutterPerspective, clutter_perspective, G_DEFINE_BOXED_TYPE (ClutterPerspective, clutter_perspective,
@ -2702,7 +2702,7 @@ clutter_stage_queue_actor_redraw (ClutterStage *stage,
} }
else else
{ {
entry = g_slice_new (QueueRedrawEntry); entry = g_new0 (QueueRedrawEntry, 1);
if (clip) if (clip)
{ {
@ -2723,7 +2723,7 @@ free_queue_redraw_entry (QueueRedrawEntry *entry)
{ {
if (entry->has_clip) if (entry->has_clip)
clutter_paint_volume_free (&entry->clip); clutter_paint_volume_free (&entry->clip);
g_slice_free (QueueRedrawEntry, entry); g_free (entry);
} }
void void

View File

@ -225,7 +225,7 @@ static TimelineMarker *
timeline_marker_new_time (const gchar *name, timeline_marker_new_time (const gchar *name,
guint msecs) guint msecs)
{ {
TimelineMarker *marker = g_slice_new (TimelineMarker); TimelineMarker *marker = g_new0 (TimelineMarker, 1);
marker->name = g_strdup (name); marker->name = g_strdup (name);
marker->quark = g_quark_from_string (marker->name); marker->quark = g_quark_from_string (marker->name);
@ -239,7 +239,7 @@ static TimelineMarker *
timeline_marker_new_progress (const gchar *name, timeline_marker_new_progress (const gchar *name,
gdouble progress) gdouble progress)
{ {
TimelineMarker *marker = g_slice_new (TimelineMarker); TimelineMarker *marker = g_new0 (TimelineMarker, 1);
marker->name = g_strdup (name); marker->name = g_strdup (name);
marker->quark = g_quark_from_string (marker->name); marker->quark = g_quark_from_string (marker->name);
@ -257,7 +257,7 @@ timeline_marker_free (gpointer data)
TimelineMarker *marker = data; TimelineMarker *marker = data;
g_free (marker->name); g_free (marker->name);
g_slice_free (TimelineMarker, marker); g_free (marker);
} }
} }

View File

@ -350,7 +350,7 @@ ClutterUnits *
clutter_units_copy (const ClutterUnits *units) clutter_units_copy (const ClutterUnits *units)
{ {
if (units != NULL) if (units != NULL)
return g_slice_dup (ClutterUnits, units); return g_memdup2 (units, sizeof (ClutterUnits));
return NULL; return NULL;
} }
@ -370,7 +370,7 @@ void
clutter_units_free (ClutterUnits *units) clutter_units_free (ClutterUnits *units)
{ {
if (units != NULL) if (units != NULL)
g_slice_free (ClutterUnits, units); g_free (units);
} }
/** /**

View File

@ -293,7 +293,7 @@ out:
static void static void
progress_data_destroy (gpointer data_) progress_data_destroy (gpointer data_)
{ {
g_slice_free (ProgressData, data_); g_free (data_);
} }
/** /**
@ -365,14 +365,14 @@ clutter_interval_register_progress_func (GType value_type,
if (func == NULL) if (func == NULL)
{ {
g_hash_table_remove (progress_funcs, type_name); g_hash_table_remove (progress_funcs, type_name);
g_slice_free (ProgressData, progress_func); g_free (progress_func);
} }
else else
progress_func->func = func; progress_func->func = func;
} }
else else
{ {
progress_func = g_slice_new (ProgressData); progress_func = g_new0 (ProgressData, 1);
progress_func->value_type = value_type; progress_func->value_type = value_type;
progress_func->func = func; progress_func->func = func;