[gnome-builder] libide/gui: remove action groups on addin unload



commit 605a93e3f14a77b9e25ce4974525572cab5e3e24
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jul 28 16:52:22 2022 -0700

    libide/gui: remove action groups on addin unload

 src/libide/gui/ide-workbench.c | 9 +++++++--
 src/libide/gui/ide-workspace.c | 4 ++++
 2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/libide/gui/ide-workbench.c b/src/libide/gui/ide-workbench.c
index ed85e5cdd..6f6c1451c 100644
--- a/src/libide/gui/ide-workbench.c
+++ b/src/libide/gui/ide-workbench.c
@@ -44,6 +44,8 @@
 #include "ide-workbench-private.h"
 #include "ide-workspace-private.h"
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GActionGroup, g_object_unref)
+
 /**
  * SECTION:ide-workbench
  * @title: IdeWorkbench
@@ -253,7 +255,7 @@ ide_workbench_addin_added_cb (PeasExtensionSet *set,
 {
   IdeWorkbench *self = user_data;
   IdeWorkbenchAddin *addin = (IdeWorkbenchAddin *)exten;
-  GActionGroup *action_group;
+  g_autoptr(GActionGroup) action_group = NULL;
 
   g_assert (PEAS_IS_EXTENSION_SET (set));
   g_assert (plugin_info != NULL);
@@ -268,7 +270,6 @@ ide_workbench_addin_added_cb (PeasExtensionSet *set,
       ide_action_muxer_insert_action_group (muxer,
                                             peas_plugin_info_get_module_name (plugin_info),
                                             action_group);
-      g_clear_object (&action_group);
     }
 
   /* Notify of the VCS system up-front */
@@ -302,6 +303,10 @@ ide_workbench_addin_removed_cb (PeasExtensionSet *set,
   g_assert (IDE_IS_WORKBENCH_ADDIN (addin));
   g_assert (IDE_IS_WORKBENCH (self));
 
+  ide_action_muxer_insert_action_group (ide_action_mixin_get_action_muxer (self),
+                                        peas_plugin_info_get_module_name (plugin_info),
+                                        NULL);
+
   /* Notify of workspace removals so addins don't need to manually
    * track them for cleanup.
    */
diff --git a/src/libide/gui/ide-workspace.c b/src/libide/gui/ide-workspace.c
index f7dc2f20f..3b2af115a 100644
--- a/src/libide/gui/ide-workspace.c
+++ b/src/libide/gui/ide-workspace.c
@@ -200,6 +200,10 @@ ide_workspace_addin_removed_cb (IdeExtensionSetAdapter *set,
   g_debug ("Unloading workspace addin from module %s",
            peas_plugin_info_get_module_name (plugin_info));
 
+  ide_action_muxer_insert_action_group (ide_action_mixin_get_action_muxer (self),
+                                        peas_plugin_info_get_module_name (plugin_info),
+                                        NULL);
+
   ide_workspace_addin_page_changed (addin, NULL);
   ide_workspace_addin_unload (addin, self);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]