forked from AuroraMiddleware/gtk
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.
This commit is contained in:
parent
c5421263e4
commit
376fc4d712
@ -287,6 +287,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)
|
||||
{
|
||||
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user