[gnome-builder/wip/gtk4-port] libide/gui: fix desruction of workbench windows



commit 89e9d0701e7df19be815342d45e0bd564f9a6dfd
Author: Christian Hergert <chergert redhat com>
Date:   Wed Mar 30 00:41:58 2022 -0700

    libide/gui: fix desruction of workbench windows

 src/libide/gui/ide-workbench.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/libide/gui/ide-workbench.c b/src/libide/gui/ide-workbench.c
index 7e8dbdef4..5df239c28 100644
--- a/src/libide/gui/ide-workbench.c
+++ b/src/libide/gui/ide-workbench.c
@@ -1484,19 +1484,21 @@ static void
 ide_workbench_unload_project_completed (IdeWorkbench *self,
                                         IdeTask      *task)
 {
+  GList *copy;
+
   g_assert (IDE_IS_WORKBENCH (self));
   g_assert (IDE_IS_TASK (task));
 
   g_clear_object (&self->addins);
 
-  while (self->mru_queue.head != NULL)
+  copy = g_list_copy_deep (self->mru_queue.head, (GCopyFunc)g_object_ref, NULL);
+  for (const GList *iter = copy; iter; iter = iter->next)
     {
-      IdeWorkspace *workspace = self->mru_queue.head->data;
-
+      IdeWorkspace *workspace = iter->data;
       g_assert (IDE_IS_WORKSPACE (workspace));
-
       gtk_window_destroy (GTK_WINDOW (workspace));
     }
+  g_list_free_full (copy, g_object_unref);
 
   _ide_foundry_unload_async (self->context,
                              ide_task_get_cancellable (task),


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