[gimp/gimp-2-8] app: make GimpContainerEntry robust against reordered parent class destruction



commit 380437e65e5a43ffc916706fd7711e09da5d4ee0
Author: Michael Natterer <mitch gimp org>
Date:   Mon Nov 5 19:56:40 2012 +0100

    app: make GimpContainerEntry robust against reordered parent class destruction
    
    So it will not warn on GTK+ 3.x. One less patch to do in gtk3-port.
    (cherry picked from commit e746fa51da1a750a6c8a346911f506082cc93e4a)

 app/widgets/gimpcontainerentry.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/app/widgets/gimpcontainerentry.c b/app/widgets/gimpcontainerentry.c
index c0d52b5..79a785a 100644
--- a/app/widgets/gimpcontainerentry.c
+++ b/app/widgets/gimpcontainerentry.c
@@ -37,10 +37,6 @@
 #include "gimpviewrenderer.h"
 
 
-#define gimp_container_entry_get_model(entry) \
-  gtk_entry_completion_get_model (gtk_entry_get_completion (GTK_ENTRY (entry)))
-
-
 static void     gimp_container_entry_view_iface_init (GimpContainerViewInterface *iface);
 
 static void     gimp_container_entry_set_context  (GimpContainerView      *view,
@@ -198,6 +194,19 @@ gimp_container_entry_new (GimpContainer *container,
 
 /*  GimpContainerView methods  */
 
+static GtkTreeModel *
+gimp_container_entry_get_model (GimpContainerView *view)
+{
+  GtkEntryCompletion *completion;
+
+  completion = gtk_entry_get_completion (GTK_ENTRY (view));
+
+  if (completion)
+    return gtk_entry_completion_get_model (completion);
+
+  return NULL;
+}
+
 static void
 gimp_container_entry_set_context (GimpContainerView *view,
                                   GimpContext       *context)
@@ -289,6 +298,10 @@ gimp_container_entry_clear_items (GimpContainerView *view)
 {
   GtkTreeModel *model = gimp_container_entry_get_model (view);
 
+  /* happens in dispose() */
+  if (! model)
+    return;
+
   gimp_container_tree_store_clear_items (GIMP_CONTAINER_TREE_STORE (model));
 
   parent_view_iface->clear_items (view);


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