gobject: Clarify assertion failure on ref-after-finalize

Rename the variables involved so that people get a slightly more
obvious critical warning when they try to ref an object which has
already been finalised.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2020-03-23 11:48:22 +00:00
parent eb0f73a39c
commit 641bbd0848

View File

@ -3361,11 +3361,13 @@ gpointer
{
GObject *object = _object;
gint old_val;
gboolean object_already_finalized;
g_return_val_if_fail (G_IS_OBJECT (object), NULL);
old_val = g_atomic_int_add (&object->ref_count, 1);
g_return_val_if_fail (old_val > 0, NULL);
object_already_finalized = (old_val <= 0);
g_return_val_if_fail (!object_already_finalized, NULL);
if (old_val == 1 && OBJECT_HAS_TOGGLE_REF (object))
toggle_refs_notify (object, FALSE);