search-directory: make sure to stop the search if no clients

Until now we were not stopping the search if no callbacks from clients
were present. That happened when the user canceled the search while the
search directory was waiting for its files metadata, since that async
call was not canceled.

This was actually making nautilus freeze on situations where the search
was so expensive that other threads couldn't cope with it.

To fix it, make sure we stop the search if no clients are present as
callbacks, and make sure we stop the load of the view when we cancel the
async call in the stop_loadin handler of the view.
parent 5a8f31fa
......@@ -492,8 +492,8 @@ search_cancel_callback (NautilusDirectory *directory,
search->details->callback_list = g_list_remove (search->details->callback_list, search_callback);
search_callback_destroy (search_callback);
return;
goto done;
}
/* Check for a pending callback */
......@@ -503,11 +503,12 @@ search_cancel_callback (NautilusDirectory *directory,
search->details->pending_callback_list = g_list_remove (search->details->pending_callback_list, search_callback);
search_callback_destroy (search_callback);
if (!search->details->pending_callback_list) {
stop_search (search);
}
}
done:
if (!search->details->callback_list && !search->details->pending_callback_list) {
stop_search (search);
}
}
static void
......
......@@ -2546,12 +2546,6 @@ 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);
for (node = view->details->scripts_directory_list; node != NULL; node = next) {
......@@ -6896,7 +6890,6 @@ load_directory (NautilusView *view,
}
old_directory = view->details->model;
disconnect_model_handlers (view);
nautilus_directory_ref (directory);
view->details->model = directory;
......@@ -7132,6 +7125,11 @@ nautilus_view_stop_loading (NautilusView *view)
{
g_return_if_fail (NAUTILUS_IS_VIEW (view));
disconnect_model_handlers (view);
if (view->details->model) {
nautilus_directory_unref (view->details->model);
view->details->model = NULL;
}
unschedule_display_of_pending_files (view);
reset_update_interval (view);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment