mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-29 21:33:30 +02:00
gobject: Handle ref_count==0 in notify_by_pspec
Just like g_object_notify, check for a zero ref_count in g_object_notify_by_pspec and leave if it is 0. This allows using functions in ->finalize() that possibly also notify a property change on the object. Previously, this resulted in an error from g_object_ref. https://bugzilla.gnome.org/show_bug.cgi?id=705570
This commit is contained in:
committed by
Colin Walters
parent
62f173f1f3
commit
4b334ef8f1
@@ -1238,6 +1238,9 @@ g_object_notify_by_pspec (GObject *object,
|
||||
g_return_if_fail (G_IS_OBJECT (object));
|
||||
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
|
||||
|
||||
if (g_atomic_int_get (&object->ref_count) == 0)
|
||||
return;
|
||||
|
||||
g_object_ref (object);
|
||||
g_object_notify_by_spec_internal (object, pspec);
|
||||
g_object_unref (object);
|
||||
|
Reference in New Issue
Block a user