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.
This commit is contained in:
Michael Natterer 2012-11-05 19:56:40 +01:00
parent 568aa7a5b0
commit e746fa51da

View file

@ -38,10 +38,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,
@ -199,6 +195,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)
@ -290,6 +299,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);