mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-16 15:10:23 +02:00
gobject: Check for valid ref counting via g_return_if_fail
Even though the check is likely to be relevant if the object is finalized, it may still give some indication if called while an instance has just lost the last reference. So use `g_return_if_fail` for consistency with the rest of the code.
This commit is contained in:
@@ -1468,9 +1468,7 @@ void
|
|||||||
g_object_freeze_notify (GObject *object)
|
g_object_freeze_notify (GObject *object)
|
||||||
{
|
{
|
||||||
g_return_if_fail (G_IS_OBJECT (object));
|
g_return_if_fail (G_IS_OBJECT (object));
|
||||||
|
g_return_if_fail (g_atomic_int_get (&object->ref_count) > 0);
|
||||||
if (g_atomic_int_get (&object->ref_count) == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
g_object_ref (object);
|
g_object_ref (object);
|
||||||
g_object_notify_queue_freeze (object, FALSE);
|
g_object_notify_queue_freeze (object, FALSE);
|
||||||
@@ -1670,8 +1668,7 @@ g_object_thaw_notify (GObject *object)
|
|||||||
GObjectNotifyQueue *nqueue;
|
GObjectNotifyQueue *nqueue;
|
||||||
|
|
||||||
g_return_if_fail (G_IS_OBJECT (object));
|
g_return_if_fail (G_IS_OBJECT (object));
|
||||||
if (g_atomic_int_get (&object->ref_count) == 0)
|
g_return_if_fail (g_atomic_int_get (&object->ref_count) > 0);
|
||||||
return;
|
|
||||||
|
|
||||||
g_object_ref (object);
|
g_object_ref (object);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user