diff options
author | Carlos Soriano <csoriano@gnome.org> | 2015-07-22 17:29:12 +0200 |
---|---|---|
committer | Carlos Soriano <csoriano@gnome.org> | 2015-07-23 18:51:34 +0200 |
commit | 5a8f31faf2122a93a6188a34e332beda4e82873f (patch) | |
tree | e95423c1b848f7a2501bc96002d49fc5d80e3748 /src/nautilus-view.c | |
parent | 3b81580a5e0328121efd036e2059ba96c0884213 (diff) | |
download | nautilus-5a8f31faf2122a93a6188a34e332beda4e82873f.tar.gz |
view: don't crash on view destroy if no model
We stop loading the view on destroy, and we add a check on
done_loading to not do some things if we are on destroy.
But the check was checking for the slot not having a window,
which actually has if the view is being destroyed while the slot
is not, like when switching views.
To avoid this crash, mark the model as NULL before all the checking,
and check for the model, not for a window in the slot.
Diffstat (limited to 'src/nautilus-view.c')
-rw-r--r-- | src/nautilus-view.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/nautilus-view.c b/src/nautilus-view.c index 8546def63..14bf2f329 100644 --- a/src/nautilus-view.c +++ b/src/nautilus-view.c @@ -2547,6 +2547,10 @@ nautilus_view_destroy (GtkWidget *object) view = NAUTILUS_VIEW (object); disconnect_model_handlers (view); + if (view->details->model) { + nautilus_directory_unref (view->details->model); + view->details->model = NULL; + } nautilus_view_stop_loading (view); @@ -2578,10 +2582,6 @@ nautilus_view_destroy (GtkWidget *object) view->details->reveal_selection_idle_id = 0; } - if (view->details->model) { - nautilus_directory_unref (view->details->model); - view->details->model = NULL; - } if (view->details->directory_as_file) { nautilus_file_unref (view->details->directory_as_file); @@ -2841,7 +2841,6 @@ done_loading (NautilusView *view, { GList *selection; gboolean do_reveal = FALSE; - NautilusWindow *window; if (!view->details->loading) { return; @@ -2849,12 +2848,9 @@ done_loading (NautilusView *view, nautilus_profile_start (NULL); - window = nautilus_view_get_window (view); - - /* This can be called during destruction, in which case there - * is no NautilusWindow any more. - */ - if (window != NULL) { + /* This can be called during destruction, in which case we set the model + * as NULL. */ + if (view->details->model != NULL) { nautilus_view_update_toolbar_menus (view); schedule_update_context_menus (view); schedule_update_status (view); |