This is my first post in gimp-dev so forgive me if I happen to miss
out context or interfere with current work in progress.

It turns out dockables aren't disposed after a gimp_dock_dispose()
call in the current master. gimp_dock_dispose() only removes dockbooks
which will not be disposed if references are still held by attached

The behavior is particularly notable on singleton dockables when
closing a floating dock window:
1. Add a new tab Tool Options to main dock
2. Drag out or detach Tool Options tab to a floating dock window
3. Close the floating dock window
4. Try to re-insert Tool Options tab in main dock. Doesn't work - as
floating dock's dockbook hasn't been disposed and Tool Options
dockable is still attached to it

I took a chance and came up with the following workaround by
explicitly removing all dockables from a dockbook upon
gimp_dock_dispose() call:

diff --git a/app/widgets/gimpdock.c b/app/widgets/gimpdock.c
index ccdeac1..c27aceb 100644
--- a/app/widgets/gimpdock.c
+++ b/app/widgets/gimpdock.c
@@ -199,9 +199,14 @@ static void
 gimp_dock_dispose (GObject *object)
   GimpDock *dock = GIMP_DOCK (object);
+  GimpDockbook *dockbook = NULL;

   while (dock->p->dockbooks)
-    gimp_dock_remove_book (dock, GIMP_DOCKBOOK (dock->p->dockbooks->data));
+    {
+      dockbook = GIMP_DOCKBOOK (dock->p->dockbooks->data);
+      gimp_dock_remove_book (dock, dockbook);
+      gimp_dockbook_remove_all (dockbook);
+    }

   G_OBJECT_CLASS (parent_class)->dispose (object);
diff --git a/app/widgets/gimpdockbook.c b/app/widgets/gimpdockbook.c
index bf47c16..3e7f267 100644
--- a/app/widgets/gimpdockbook.c
+++ b/app/widgets/gimpdockbook.c
@@ -1081,6 +1081,14 @@ gimp_dockbook_remove (GimpDockbook *dockbook,

+gimp_dockbook_remove_all (GimpDockbook *dockbook)
+  g_return_if_fail (GIMP_IS_DOCKBOOK (dockbook));
+  while (dockbook->p->dockables)
+    gimp_dockbook_remove(dockbook,
  * gimp_dockbook_update_with_context:
  * @dockbook:
diff --git a/app/widgets/gimpdockbook.h b/app/widgets/gimpdockbook.h
index 2af7b40..434495a 100644
--- a/app/widgets/gimpdockbook.h
+++ b/app/widgets/gimpdockbook.h
@@ -73,6 +73,7 @@ GtkWidget     *
gimp_dockbook_add_from_dialog_factory   (GimpDockbook    *dockbo
 void            gimp_dockbook_remove                    (GimpDockbook
+void            gimp_dockbook_remove_all                (GimpDockbook
 void            gimp_dockbook_update_with_context       (GimpDockbook
 GtkWidget    *  gimp_dockbook_create_tab_widget         (GimpDockbook
Gimp-developer mailing list

Reply via email to