mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-27 17:52:58 +02:00
provide marshaller specific value_set_*_take_ownership() variants.
Sun Feb 16 22:08:48 2002 Tim Janik <timj@gtk.org> * gobject.[hc]: * gparam.[hc]: provide marshaller specific value_set_*_take_ownership() variants. * gvalue.h: shrink GValue's data contents to 2 unions. * glib-genmarshal.c: fix release and realeas_check hackage by always using _take_ownership() variants. directly access value contents if G_ENABLE_DEBUG is not defined. * gobject.h: add padding pointers to the class struct.
This commit is contained in:
@@ -1526,6 +1526,27 @@ g_value_set_object (GValue *value,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
g_value_set_object_take_ownership (GValue *value,
|
||||
gpointer v_object)
|
||||
{
|
||||
g_return_if_fail (G_VALUE_HOLDS_OBJECT (value));
|
||||
|
||||
if (value->data[0].v_pointer)
|
||||
{
|
||||
g_object_unref (value->data[0].v_pointer);
|
||||
value->data[0].v_pointer = NULL;
|
||||
}
|
||||
|
||||
if (v_object)
|
||||
{
|
||||
g_return_if_fail (G_IS_OBJECT (v_object));
|
||||
g_return_if_fail (g_value_type_compatible (G_OBJECT_TYPE (v_object), G_VALUE_TYPE (value)));
|
||||
|
||||
value->data[0].v_pointer = v_object; /* we take over the reference count */
|
||||
}
|
||||
}
|
||||
|
||||
gpointer
|
||||
g_value_get_object (const GValue *value)
|
||||
{
|
||||
|
Reference in New Issue
Block a user