mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-29 21:33:30 +02:00
gobject: Check for toggle references only if the old ref is relevant
If an object gets revitalized during the dispose vfunc, we need to call toggle refs notifiers only if we had 2 references and if the object has the toggle references enabled. This may change in case an object notifier handler changes this status, so do this check only after we've called the notifiers so that in case toggle notifications are enabled afterwards we still call the handlers.
This commit is contained in:
@@ -1110,14 +1110,14 @@ test_toggle_ref_and_notify_on_dispose (void)
|
||||
obj->expected.count = 5;
|
||||
obj->notify_handler = G_CALLBACK (on_object_notify_switch_to_toggle_ref);
|
||||
g_object_unref (obj);
|
||||
g_assert_cmpint (obj->actual.count, ==, 6);
|
||||
g_assert_cmpint (obj->actual.count, ==, 7);
|
||||
g_assert_cmpuint (obj->notify_called, ==, 3);
|
||||
|
||||
disposed_checker = &obj;
|
||||
g_object_add_weak_pointer (G_OBJECT (obj), &disposed_checker);
|
||||
|
||||
obj->disposing_refs = 0;
|
||||
obj->expected.count = 6;
|
||||
obj->expected.count = 7;
|
||||
g_clear_object (&obj);
|
||||
g_assert_null (disposed_checker);
|
||||
}
|
||||
|
Reference in New Issue
Block a user