[balsa] Do not crash on early exit



commit b151f46d14a0c88bd6d0ae3a9c6cd00c91dd2e88
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sat Mar 27 13:05:49 2010 -0400

    Do not crash on early exit
    
    	* src/main-window.c: do not crash on early exit.

 ChangeLog         |    4 ++++
 src/main-window.c |   11 +++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8e873c7..5d6dec5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2010-03-27  Peter Bloomfield
 
+	* src/main-window.c: do not crash on early exit.
+
+2010-03-27  Peter Bloomfield
+
 	* configure.in: build with gtkhtml2.
 
 2010-03-27  Peter Bloomfield
diff --git a/src/main-window.c b/src/main-window.c
index 83f0ab1..bb9292e 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -2239,8 +2239,9 @@ bw_mailbox_changed(LibBalsaMailbox * mailbox, GtkLabel * lab)
 static void
 bw_notebook_label_notify(LibBalsaMailbox * mailbox, GtkLabel * lab)
 {
-    g_signal_handlers_disconnect_by_func(mailbox, bw_mailbox_changed,
-					 lab);
+    if (LIBBALSA_IS_MAILBOX(mailbox))
+        g_signal_handlers_disconnect_by_func(mailbox, bw_mailbox_changed,
+                                             lab);
 }
 
 static GtkWidget *
@@ -2392,15 +2393,17 @@ bw_real_open_mbnode_thread(GPtrArray *info_array)
 
         pthread_mutex_unlock(&open_lock);
         gdk_threads_enter();
+
         bw_real_open_mbnode(info->window, info->mbnode, info->set_current);
-        gdk_threads_leave();
-        pthread_mutex_lock(&open_lock);
 
 	if (info->window)
             g_object_remove_weak_pointer(G_OBJECT(info->window),
                                          (gpointer) &info->window);
         g_object_unref(info->mbnode);
+
+        gdk_threads_leave();
         g_free(info);
+        pthread_mutex_lock(&open_lock);
     }
 
     info_array->len = 0;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]