[gtk+/gtk-2-24] gtk: clean up properly in GtkFileChooserEntry's dispose() to fix crashes
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-24] gtk: clean up properly in GtkFileChooserEntry's dispose() to fix crashes
- Date: Mon, 5 Nov 2012 19:18:26 +0000 (UTC)
commit 376fc4d712ab16b3770c79b55e00c1b8bc1efcfd
Author: Michael Natterer <mitch gimp org>
Date: Mon Nov 5 20:15:17 2012 +0100
gtk: clean up properly in GtkFileChooserEntry's dispose() to fix crashes
Don't just unref the completion_store, call discard_completion_store()
instead which also unsets it as the GtkEntryCompletion's model. Fixes
bug 681845 and probably some others, because the situation in this bug
is completely common.
gtk/gtkfilechooserentry.c | 28 ++++++++++++----------------
1 files changed, 12 insertions(+), 16 deletions(-)
---
diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c
index cc398a6..238d1fb 100644
--- a/gtk/gtkfilechooserentry.c
+++ b/gtk/gtkfilechooserentry.c
@@ -288,6 +288,17 @@ discard_loading_and_current_folder_file (GtkFileChooserEntry *chooser_entry)
}
static void
+discard_completion_store (GtkFileChooserEntry *chooser_entry)
+{
+ if (!chooser_entry->completion_store)
+ return;
+
+ gtk_entry_completion_set_model (gtk_entry_get_completion (GTK_ENTRY (chooser_entry)), NULL);
+ g_object_unref (chooser_entry->completion_store);
+ chooser_entry->completion_store = NULL;
+}
+
+static void
gtk_file_chooser_entry_dispose (GObject *object)
{
GtkFileChooserEntry *chooser_entry = GTK_FILE_CHOOSER_ENTRY (object);
@@ -302,11 +313,7 @@ gtk_file_chooser_entry_dispose (GObject *object)
chooser_entry->start_autocompletion_idle_id = 0;
}
- if (chooser_entry->completion_store)
- {
- g_object_unref (chooser_entry->completion_store);
- chooser_entry->completion_store = NULL;
- }
+ discard_completion_store (chooser_entry);
if (chooser_entry->file_system)
{
@@ -1297,17 +1304,6 @@ gtk_file_chooser_entry_activate (GtkEntry *entry)
GTK_ENTRY_CLASS (_gtk_file_chooser_entry_parent_class)->activate (entry);
}
-static void
-discard_completion_store (GtkFileChooserEntry *chooser_entry)
-{
- if (!chooser_entry->completion_store)
- return;
-
- gtk_entry_completion_set_model (gtk_entry_get_completion (GTK_ENTRY (chooser_entry)), NULL);
- g_object_unref (chooser_entry->completion_store);
- chooser_entry->completion_store = NULL;
-}
-
/* Fills the completion store from the contents of the current folder */
static void
populate_completion_store (GtkFileChooserEntry *chooser_entry)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]