Fix bug #3055, "Claws segfaults when cancelling a sticky search
authorColin Leroy <colin@colino.net>
Tue, 8 Apr 2014 14:13:04 +0000 (16:13 +0200)
committerColin Leroy <colin@colino.net>
Tue, 8 Apr 2014 14:13:04 +0000 (16:13 +0200)
after changing folder"

src/gtk/quicksearch.c
src/summaryview.c

index 8f45185..52ebc1a 100644 (file)
@@ -167,10 +167,19 @@ static void quicksearch_invoke_execute(QuickSearch *quicksearch, gboolean run_on
 gboolean quicksearch_run_on_folder(QuickSearch* quicksearch, FolderItem *folderItem, MsgInfoList **result)
 {
        if (quicksearch_has_sat_predicate(quicksearch)) {
+               gboolean was_running = quicksearch_is_running(quicksearch);
                gboolean searchres;
+
+               if (!was_running)
+                       quicksearch_set_running(quicksearch, TRUE);
+
                main_window_cursor_wait(mainwindow_get_mainwindow());
                searchres = advsearch_search_msgs_in_folders(quicksearch->asearch, result, folderItem, FALSE);
                main_window_cursor_normal(mainwindow_get_mainwindow());
+
+               if (!was_running)
+                       quicksearch_set_running(quicksearch, FALSE);
+
                if (quicksearch->want_reexec) {
                        advsearch_set(quicksearch->asearch, quicksearch->request.type, "");
                }
index 7e442c7..2e80178 100644 (file)
@@ -1379,7 +1379,6 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item)
 
                if (!quicksearch_has_sat_predicate(summaryview->quicksearch)) {
                        debug_print("search cancelled!\n");
-                       printf("search cancelled!\n");
                        summary_thaw(summaryview);
                        STATUSBAR_POP(summaryview->mainwin);
                        main_window_cursor_normal(summaryview->mainwin);