Re: [Gimp-developer] Dockables aren't disposed when closing floating dock window

2011-08-13 Thread Martin Nordholts
2011/8/13 P S psweb...@gmail.com:
 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
 dockables.

 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

You don't happen to be running Ubuntu 11.04 are you? Their GTK+
installation seems to be broken. Try building GTK+ yourself,
preferably GTK+ 2.24.5 and see if the problem goes away.

BR,
Martin


-- 

My GIMP Blog:
http://www.chromecode.com/
GIMP 2.8 schedule on tasktaste.com
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


[Gimp-developer] Dockables aren't disposed when closing floating dock window

2011-08-12 Thread P S
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
dockables.

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,
 }
 }

+void
+gimp_dockbook_remove_all (GimpDockbook *dockbook)
+{
+  g_return_if_fail (GIMP_IS_DOCKBOOK (dockbook));
+
+  while (dockbook-p-dockables)
+gimp_dockbook_remove(dockbook,
GIMP_DOCKABLE(dockbook-p-dockables-data));
+}
 /**
  * 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
  gint
position);
 voidgimp_dockbook_remove(GimpDockbook
   *dockbook,
  GimpDockable
   *dockable);
+voidgimp_dockbook_remove_all(GimpDockbook
   *dockbook);
 voidgimp_dockbook_update_with_context   (GimpDockbook
   *dockbook,
  GimpContext
   *context);
 GtkWidget*  gimp_dockbook_create_tab_widget (GimpDockbook
   *dockbook,
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer