Fix crash in dangling message search.
authorColin Leroy <colin@colino.net>
Wed, 17 Oct 2018 07:26:26 +0000 (09:26 +0200)
committerColin Leroy <colin@colino.net>
Wed, 17 Oct 2018 07:26:26 +0000 (09:26 +0200)
src/compose.c
src/message_search.c
src/message_search.h
src/messageview.c

index 0d8f774..11e0b6e 100644 (file)
@@ -9160,6 +9160,7 @@ static void compose_destroy(Compose *compose)
        clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
        gtk_text_buffer_remove_selection_clipboard(buffer, clipboard);
 
+       message_search_close(compose);
        gtk_widget_destroy(compose->window);
        toolbar_destroy(compose->toolbar);
        g_free(compose->toolbar);
index 1f50a22..e73fe87 100644 (file)
@@ -122,6 +122,17 @@ void message_search_compose(Compose *compose)
        message_search_other(&compose_interface, (void *)compose);
 }
 
+void message_search_close (void *obj)
+{
+       if(!search_window.window) {
+               return;
+       }
+       if (search_window.interface_obj == obj) {
+               gtk_widget_hide(search_window.window);
+               search_window.interface_obj = NULL;
+       }
+}
+
 void message_search_other(SearchInterface *interface, void *obj)
 {
        if (!search_window.window)
index e6ab436..b5218bf 100644 (file)
@@ -38,5 +38,6 @@ typedef struct {
 void message_search    (MessageView    *messageview);
 void message_search_compose    (Compose        *compose);
 void message_search_other      (SearchInterface        *source, void *obj);
+void message_search_close      (void *obj);
 
 #endif /* __MESSAGE_SEARCH_H__ */
index 829f158..fe9767d 100644 (file)
@@ -1637,6 +1637,8 @@ void messageview_destroy(MessageView *messageview)
                g_free(messageview->toolbar);
        }
 
+       message_search_close(messageview);
+
        list_free_strings_full(messageview->trail);
        msgview_list = g_list_remove(msgview_list, messageview);