gobject: remove data when last toggle ref is removed

Toggle refs are seldom used, and when they are, it makes mostly sense that
there is only one of them. Thus, when removing the last toggle ref, also
remove the associated data.
This commit is contained in:
Thomas Haller 2023-12-19 08:53:42 +01:00
parent 4da4220c8b
commit 2276099236

View File

@ -3723,7 +3723,10 @@ g_object_remove_toggle_ref (GObject *object,
tstack->toggle_refs[i] = tstack->toggle_refs[tstack->n_toggle_refs];
if (tstack->n_toggle_refs == 0)
{
g_datalist_unset_flags (&object->qdata, OBJECT_HAS_TOGGLE_REF_FLAG);
g_datalist_id_set_data_full (&object->qdata, quark_toggle_refs, NULL, NULL);
}
break;
}