mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
Order refs/unrefs so setting the same object back is safe. (#112861,
Fri May 30 14:42:24 2003 Owen Taylor <otaylor@redhat.com> * gobject.c (g_value_set_object): Order refs/unrefs so setting the same object back is safe. (#112861, Morten Welinder)
This commit is contained in:
parent
614e5ed63a
commit
68e49c7811
@ -1,3 +1,9 @@
|
||||
Fri May 30 14:42:24 2003 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gobject.c (g_value_set_object): Order refs/unrefs
|
||||
so setting the same object back is safe. (#112861,
|
||||
Morten Welinder)
|
||||
|
||||
2003-03-24 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* gtype.c (type_data_finalize_class_ifaces_Wm): removed leftover
|
||||
|
@ -1508,14 +1508,12 @@ void
|
||||
g_value_set_object (GValue *value,
|
||||
gpointer v_object)
|
||||
{
|
||||
GObject *old;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
old = value->data[0].v_pointer;
|
||||
|
||||
if (v_object)
|
||||
{
|
||||
g_return_if_fail (G_IS_OBJECT (v_object));
|
||||
@ -1524,6 +1522,11 @@ g_value_set_object (GValue *value,
|
||||
value->data[0].v_pointer = v_object;
|
||||
g_object_ref (value->data[0].v_pointer);
|
||||
}
|
||||
else
|
||||
value->data[0].v_pointer = NULL;
|
||||
|
||||
if (old)
|
||||
g_object_unref (old);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user