action muxer: Be safe against reinsertion

Be prepared for the eventuality that somebody
might reinsert the same action group without
holding any extra references on it.

This was observed as causing crashes in
gnome-builder.
This commit is contained in:
Matthias Clasen 2019-06-23 22:55:19 +00:00
parent f8251a4da9
commit e873c98e25

View File

@ -683,12 +683,14 @@ gtk_action_muxer_insert (GtkActionMuxer *muxer,
Group *group;
gint i;
g_object_ref (action_group);
/* TODO: diff instead of ripout and replace */
gtk_action_muxer_remove (muxer, prefix);
group = g_slice_new (Group);
group->muxer = muxer;
group->group = g_object_ref (action_group);
group->group = action_group;
group->prefix = g_strdup (prefix);
g_hash_table_insert (muxer->groups, group->prefix, group);