[gimp] app: Make gimp_paned_box_remove_widget() more destruction friendly



commit 9ea1d490a4183dc0c3d938797e6f57d4c7b14989
Author: Martin Nordholts <martinn src gnome org>
Date:   Sun Nov 29 15:07:10 2009 +0100

    app: Make gimp_paned_box_remove_widget() more destruction friendly
    
    When closing a GimpDockWindow, the GtkBox code might already have
    removed the widget. In that case we don't need to do anything.

 app/widgets/gimppanedbox.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/app/widgets/gimppanedbox.c b/app/widgets/gimppanedbox.c
index 16b6301..2e74892 100644
--- a/app/widgets/gimppanedbox.c
+++ b/app/widgets/gimppanedbox.c
@@ -255,7 +255,11 @@ gimp_paned_box_remove_widget (GimpPanedBox *paned_box,
   /* Remove from widget hierarchy */
   if (old_length == 1)
     {
-      gtk_container_remove (GTK_CONTAINER (paned_box), widget);
+      /* The widget might already be parent-less if we are in
+       * destruction, .e.g when closing a dock window.
+       */
+      if (gtk_widget_get_parent (widget) != NULL)
+        gtk_container_remove (GTK_CONTAINER (paned_box), widget);
     }
   else
     {



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