mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 23:16:14 +01:00
gobject: adjust assertion for ref-count in g_object_freeze_notify()
g_atomic_int_get() returns a signed int. While we don't expect this to be ever negative, a negative value would also indicate a bug. Adjust the check to assert against negative ref-count too.
This commit is contained in:
parent
30d6e911c4
commit
28331deae2
@ -1433,7 +1433,7 @@ g_object_freeze_notify (GObject *object)
|
||||
g_return_if_fail (G_IS_OBJECT (object));
|
||||
|
||||
#ifndef G_DISABLE_CHECKS
|
||||
if (G_UNLIKELY (g_atomic_int_get (&object->ref_count) == 0))
|
||||
if (G_UNLIKELY (g_atomic_int_get (&object->ref_count) <= 0))
|
||||
{
|
||||
g_critical ("Attempting to freeze the notification queue for object %s[%p]; "
|
||||
"Property notification does not work during instance finalization.",
|
||||
@ -1643,7 +1643,7 @@ g_object_thaw_notify (GObject *object)
|
||||
g_return_if_fail (G_IS_OBJECT (object));
|
||||
|
||||
#ifndef G_DISABLE_CHECKS
|
||||
if (G_UNLIKELY (g_atomic_int_get (&object->ref_count) == 0))
|
||||
if (G_UNLIKELY (g_atomic_int_get (&object->ref_count) <= 0))
|
||||
{
|
||||
g_critical ("Attempting to thaw the notification queue for object %s[%p]; "
|
||||
"Property notification does not work during instance finalization.",
|
||||
|
Loading…
Reference in New Issue
Block a user