[nautilus/wip/csoriano/next-18: 8/13] files-view: use explicit in_destruction boolean



commit f9d6a040d8cd00eeb86b5b84c51785b76775007d
Author: Carlos Soriano <csoriano gnome org>
Date:   Wed Jan 13 19:05:54 2016 +0100

    files-view: use explicit in_destruction boolean
    
    So we were relying on the model to be NULL to not update all
    the view widgets and details in the done_loading callback.
    
    However, we need the model alive so in the signal of is-loading
    emitted on the done_loading function, external objects can peek
    the model, etc. even in destruction time.
    
    So instead of setting the model as NULL on destroy and relying on it,
    use a explicit boolean to not update view widgets on destroy.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759717

 src/nautilus-files-view.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 716b529..bb98091 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -225,6 +225,8 @@ struct NautilusFilesViewDetails
         gboolean templates_present;
         gboolean scripts_present;
 
+        gboolean in_destruction;
+
         gboolean sort_directories_first;
 
         gboolean show_foreign_files;
@@ -2813,6 +2815,7 @@ nautilus_files_view_destroy (GtkWidget *object)
 
         view = NAUTILUS_FILES_VIEW (object);
 
+        view->details->in_destruction = TRUE;
         nautilus_files_view_stop_loading (view);
 
         for (node = view->details->scripts_directory_list; node != NULL; node = next) {
@@ -3134,9 +3137,7 @@ done_loading (NautilusFilesView *view,
 
         nautilus_profile_start (NULL);
 
-        /* This can be called during destruction, in which case we set the model
-         * as NULL. */
-        if (view->details->model != NULL) {
+        if (!view->details->in_destruction) {
                 nautilus_files_view_update_toolbar_menus (view);
                 remove_loading_floating_bar (view);
                 schedule_update_context_menus (view);
@@ -8076,6 +8077,8 @@ nautilus_files_view_init (NautilusFilesView *view)
                                   "changed::" NAUTILUS_PREFERENCES_LOCKDOWN_COMMAND_LINE,
                                   G_CALLBACK (schedule_update_context_menus), view);
 
+        view->details->in_destruction = FALSE;
+
         /* Accessibility */
         atk_object = gtk_widget_get_accessible (GTK_WIDGET (view));
         atk_object_set_name (atk_object, _("Content View"));


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