From 2276099236a7b8096aa03b4b06206f389ac5a614 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 19 Dec 2023 08:53:42 +0100 Subject: [PATCH] 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. --- gobject/gobject.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gobject/gobject.c b/gobject/gobject.c index 569de1701..b12a0548b 100644 --- a/gobject/gobject.c +++ b/gobject/gobject.c @@ -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_unset_flags (&object->qdata, OBJECT_HAS_TOGGLE_REF_FLAG); + g_datalist_id_set_data_full (&object->qdata, quark_toggle_refs, NULL, NULL); + } break; }