Commit eaab96c0 authored by Javier Jardón's avatar Javier Jardón

Use GSlice for GtkRequisition

Also add gtk_requisition_new to avoid memory allocator confusions when
using GtkRequisitions.

Based on a Christian Persch patch.
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=461618
parent bcbb976d
......@@ -4942,6 +4942,7 @@ gtk_widget_get_requisition
gtk_widget_device_is_shadowed
<SUBSECTION>
gtk_requisition_new
gtk_requisition_copy
gtk_requisition_free
......
......@@ -4312,6 +4312,7 @@ gtk_vseparator_new
gtk_requisition_copy
gtk_requisition_free
gtk_requisition_get_type G_GNUC_CONST
gtk_requisition_new G_GNUC_MALLOC
gtk_widget_activate
gtk_widget_is_composited
gtk_widget_add_accelerator
......
......@@ -10240,6 +10240,22 @@ gtk_widget_class_path (GtkWidget *widget,
}
}
/**
* gtk_requisition_new:
*
* Allocates a new #GtkRequisition structure and initializes its elements to zero.
*
* Returns: a new empty #GtkRequisition. The newly allocated #GtkRequisition should
* be freed with gtk_requisition_free().
*
* Since: 3.0
*/
GtkRequisition *
gtk_requisition_new (void)
{
return g_slice_new0 (GtkRequisition);
}
/**
* gtk_requisition_copy:
* @requisition: a #GtkRequisition
......@@ -10251,7 +10267,7 @@ gtk_widget_class_path (GtkWidget *widget,
GtkRequisition *
gtk_requisition_copy (const GtkRequisition *requisition)
{
return (GtkRequisition *)g_memdup (requisition, sizeof (GtkRequisition));
return g_slice_dup (GtkRequisition, requisition);
}
/**
......@@ -10263,7 +10279,7 @@ gtk_requisition_copy (const GtkRequisition *requisition)
void
gtk_requisition_free (GtkRequisition *requisition)
{
g_free (requisition);
g_slice_free (GtkRequisition, requisition);
}
GType
......
......@@ -954,6 +954,7 @@ void gtk_widget_set_has_tooltip (GtkWidget *widget,
gboolean gtk_widget_get_has_tooltip (GtkWidget *widget);
GType gtk_requisition_get_type (void) G_GNUC_CONST;
GtkRequisition *gtk_requisition_new (void) G_GNUC_MALLOC;
GtkRequisition *gtk_requisition_copy (const GtkRequisition *requisition);
void gtk_requisition_free (GtkRequisition *requisition);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment