diff options
author | Carlos Soriano <csoriano@gnome.org> | 2016-01-13 19:45:40 +0100 |
---|---|---|
committer | Carlos Soriano <csoriano@gnome.org> | 2016-01-18 11:01:43 +0100 |
commit | 70f5cda7ae67d6fa18a683f74559c0827d1cd794 (patch) | |
tree | 094f87d0cd6d8a494e76e9a6677ef728a9ca932c | |
parent | f9d6a040d8cd00eeb86b5b84c51785b76775007d (diff) | |
download | nautilus-70f5cda7ae67d6fa18a683f74559c0827d1cd794.tar.gz |
window-slot: use cancel_change instead of end_change
Nautilus slot ends any location change before starting a new
one or when is done loading.
The done loading signal is emitted when the view finalize to load
a directory.
However, when loading a new location, if the previous one was not
finalized to load, nautilus was crashing, due to the is-loading signal
in the view first emitting it for finalizing the previous location
change.
Then the callback of window slot was freeing the new_content_view,
because this callback can be done when canceling a location change.
However, at that time, the new_content_view is actually the one which
is going to be used as a content view when we are just changing
locations, for example, while searching.
It's kind of strange that the callback of the view ending a load
frees the new_content_view, since this is already managed by setup_view.
And since we already have a cancel_location_change, we can use that
on the majority of situations when we actually want to cancel a change,
and let the end_location callback for the specific case of ending a load
of the view.
So now only the cancel_location_change frees the new_content_view, and
we avoid a crash freeing the current view while loading it when changing
locations.
This is the last patch of the series of patches to fix the crashing
nautilus while searching.
https://bugzilla.gnome.org/show_bug.cgi?id=759717
-rw-r--r-- | src/nautilus-window-slot.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c index 0c07df245..19991d902 100644 --- a/src/nautilus-window-slot.c +++ b/src/nautilus-window-slot.c @@ -926,11 +926,7 @@ begin_location_change (NautilusWindowSlot *slot, nautilus_window_slot_disconnect_content_view (slot); /* We are going to change the location, so make sure we stop any loading * or searching of the previous view, so we avoid to be slow */ - if (slot->details->content_view && NAUTILUS_IS_FILES_VIEW (slot->details->content_view)) { - nautilus_files_view_stop_loading (NAUTILUS_FILES_VIEW (slot->details->content_view)); - } - - end_location_change (slot); + nautilus_window_slot_stop_loading (slot); nautilus_window_slot_set_allow_stop (slot, TRUE); @@ -1568,11 +1564,6 @@ free_location_change (NautilusWindowSlot *slot) got_file_info_for_view_selection_callback, slot); slot->details->determine_view_file = NULL; } - - if (slot->details->new_content_view != NULL) { - g_object_unref (slot->details->new_content_view); - slot->details->new_content_view = NULL; - } } static void @@ -1611,6 +1602,11 @@ cancel_location_change (NautilusWindowSlot *slot) } end_location_change (slot); + + if (slot->details->new_content_view) { + g_object_unref (slot->details->new_content_view); + slot->details->new_content_view = NULL; + } } void @@ -1635,7 +1631,7 @@ nautilus_window_slot_set_content_view (NautilusWindowSlot *slot, selection = nautilus_view_get_selection (slot->details->content_view); view = nautilus_files_view_new (id, slot); - end_location_change (slot); + nautilus_window_slot_stop_loading (slot); nautilus_window_slot_set_allow_stop (slot, TRUE); |