[gtk+] file chooser: Avoid a crash



commit f793da54a992d87da42c1f98e3cd5e9556c670ab
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jan 30 23:07:56 2016 -0500

    file chooser: Avoid a crash
    
    Since 39c2d12330b6d4405ca8a5599c12017c58626fcf,
    priv->operation_mode == OPERATION_MODE_BROWSE no longer
    guarantees that priv->browse_files_model is the current
    model of the list - we are only switching the models after
    loading the new directory. Avoid triggering the assertion
    in show_and_select_files by checking if we have right model
    before calling it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=761209

 gtk/gtkfilechooserwidget.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 127e18b..d1a2ed8 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -5630,15 +5630,19 @@ gtk_file_chooser_widget_select_file (GtkFileChooser  *chooser,
   GtkFileChooserWidgetPrivate *priv = impl->priv;
   GFile *parent_file;
   gboolean same_path;
+  GtkFileSystemModel *fsmodel;
 
   parent_file = g_file_get_parent (file);
 
   if (!parent_file)
     return gtk_file_chooser_set_current_folder_file (chooser, file, error);
 
+  fsmodel = GTK_FILE_SYSTEM_MODEL (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->browse_files_tree_view)));
+
   if (priv->operation_mode == OPERATION_MODE_SEARCH ||
       priv->operation_mode == OPERATION_MODE_RECENT ||
-      priv->load_state == LOAD_EMPTY)
+      priv->load_state == LOAD_EMPTY ||
+      priv->browse_files_model != fsmodel)
     {
       same_path = FALSE;
     }


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