diff options
author | correctmost <[email protected]> | 2024-01-10 04:17:16 -0500 |
---|---|---|
committer | raveit65 <[email protected]> | 2024-02-15 16:59:03 +0100 |
commit | bfa5f0a8ebe12e6e0918ce35e276c1189c8253ff (patch) | |
tree | aace811773d0b13f2eae4f04f233be786f1383a6 /libmenu | |
parent | 9dc2785417f29a5354cf5f64f9342e146035372e (diff) | |
download | mate-menus-bfa5f0a8ebe12e6e0918ce35e276c1189c8253ff.tar.bz2 mate-menus-bfa5f0a8ebe12e6e0918ce35e276c1189c8253ff.tar.xz |
matemenu-tree: Fix crash when adding launcher from compact menu
The emit_changed_signal callback was attempting to run on a
submenu that had already been destroyed by its parent menu.
Closes #116
Diffstat (limited to 'libmenu')
-rw-r--r-- | libmenu/matemenu-tree.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libmenu/matemenu-tree.c b/libmenu/matemenu-tree.c index 99c51a2..0260a6d 100644 --- a/libmenu/matemenu-tree.c +++ b/libmenu/matemenu-tree.c @@ -85,6 +85,7 @@ struct _MateMenuTree #ifdef WITH_COLLECTION GPtrArray *collection_applet; GSettings *settings; + guint emit_changed_signal; #endif /* WITH_COLLECTION */ MateMenuTreeFlags flags; @@ -660,6 +661,9 @@ matemenu_tree_finalize (GObject *object) tree); g_object_unref (tree->settings); + if (tree->emit_changed_signal != 0) + g_source_remove (tree->emit_changed_signal); + tree->emit_changed_signal = 0; #endif /* WITH_COLLECTION */ G_OBJECT_CLASS (matemenu_tree_parent_class)->finalize (object); @@ -708,6 +712,8 @@ static gboolean emit_changed_signal (gpointer data) { MateMenuTree *self = data; + self->emit_changed_signal = 0; + matemenu_tree_force_rebuild (self); matemenu_tree_invoke_monitors (self); @@ -739,7 +745,8 @@ collection_applet_changed (GSettings *settings, self->collection_applet = NULL; } get_panel_collection_applet (self); - g_idle_add (emit_changed_signal, (gpointer)self); + if (self->emit_changed_signal == 0) + self->emit_changed_signal = g_idle_add (emit_changed_signal, (gpointer)self); } #endif /* WITH_COLLECTION */ @@ -754,6 +761,7 @@ matemenu_tree_init (MateMenuTree *self) g_signal_connect (self->settings, "changed::object-id-list", G_CALLBACK (collection_applet_changed), self); + self->emit_changed_signal = 0; #endif /* WITH_COLLECTION */ } |