[gnome-builder/wip/gtk4-port] libide/gui: force destruction of editor grid first



commit 615a80205bda51451236733a9b69ff84eeed676d
Author: Christian Hergert <chergert redhat com>
Date:   Tue Apr 5 12:02:23 2022 -0700

    libide/gui: force destruction of editor grid first
    
    It is most likely that the pages need to be destroyed before any of the
    other widgetry (which might be displaying information for pages). This
    ensures the cleanup order is pages first, then other left over widgetry.

 src/libide/gui/ide-primary-workspace.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/gui/ide-primary-workspace.c b/src/libide/gui/ide-primary-workspace.c
index 9ad1353f1..ebed70d78 100644
--- a/src/libide/gui/ide-primary-workspace.c
+++ b/src/libide/gui/ide-primary-workspace.c
@@ -55,6 +55,7 @@ struct _IdePrimaryWorkspace
   IdeRunButton       *run_button;
   GtkLabel           *project_title;
   GtkMenuButton      *add_button;
+  PanelDock          *dock;
   PanelPaned         *edge_start;
   PanelPaned         *edge_end;
   PanelPaned         *edge_bottom;
@@ -205,21 +206,40 @@ ide_primary_workspace_get_most_recent_frame (IdeWorkspace *workspace)
   return IDE_FRAME (panel_grid_get_most_recent_frame (PANEL_GRID (self->grid)));
 }
 
+static void
+ide_primary_workspace_dispose (GObject *object)
+{
+  IdePrimaryWorkspace *self = (IdePrimaryWorkspace *)object;
+
+  /* Ensure that the grid is removed first so that it will cleanup
+   * addins/pages/etc before we ever get to removing the workspace
+   * addins as part of the parent class.
+   */
+  panel_dock_remove (self->dock, GTK_WIDGET (self->grid));
+  self->grid = NULL;
+
+  G_OBJECT_CLASS (ide_primary_workspace_parent_class)->dispose (object);
+}
+
 static void
 ide_primary_workspace_class_init (IdePrimaryWorkspaceClass *klass)
 {
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
   IdeWorkspaceClass *workspace_class = IDE_WORKSPACE_CLASS (klass);
 
-  ide_workspace_class_set_kind (workspace_class, "primary");
+  object_class->dispose = ide_primary_workspace_dispose;
 
   workspace_class->context_set = ide_primary_workspace_context_set;
   workspace_class->add_page = ide_primary_workspace_add_page;
   workspace_class->add_pane = ide_primary_workspace_add_pane;
   workspace_class->get_most_recent_frame = ide_primary_workspace_get_most_recent_frame;
 
+  ide_workspace_class_set_kind (workspace_class, "primary");
+
   gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/libide-gui/ui/ide-primary-workspace.ui");
   gtk_widget_class_bind_template_child (widget_class, IdePrimaryWorkspace, add_button);
+  gtk_widget_class_bind_template_child (widget_class, IdePrimaryWorkspace, dock);
   gtk_widget_class_bind_template_child (widget_class, IdePrimaryWorkspace, edge_bottom);
   gtk_widget_class_bind_template_child (widget_class, IdePrimaryWorkspace, edge_end);
   gtk_widget_class_bind_template_child (widget_class, IdePrimaryWorkspace, edge_start);


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