[balsa] Clear mailbox_node before destroying BalsaIndex



commit 0ed8f5ebbaadf85a9dc61c32267381e6ca2db29b
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Mon Jan 18 21:00:53 2010 -0500

    Clear mailbox_node before destroying BalsaIndex
    
    	* src/balsa-index.c (bndx_mbnode_weak_notify), (bndx_destroy),
    	(balsa_index_load_mailbox_node): clear BalsaIndex::mailbox_node
    	before destroying BalsaIndex.

 ChangeLog         |    8 ++++++++
 src/balsa-index.c |   20 +++++++++++++++-----
 2 files changed, 23 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8f8d0e4..a6f7f20 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-01-18  Peter Bloomfield  <peter t43 bellsouth net>
+
+	reviewed by: <delete if not using a buddy>
+
+	* src/balsa-index.c (bndx_mbnode_weak_notify), (bndx_destroy),
+	(balsa_index_load_mailbox_node): clear BalsaIndex::mailbox_node
+	before destroying BalsaIndex.
+
 2010-01-18  Peter Bloomfield
 
 	* src/balsa-app.c (balsa_find_url): check for NULL
diff --git a/src/balsa-index.c b/src/balsa-index.c
index 709b917..699b9a0 100644
--- a/src/balsa-index.c
+++ b/src/balsa-index.c
@@ -202,6 +202,14 @@ bndx_class_init(BalsaIndexClass * klass)
 
 /* Object class destroy method. */
 static void
+bndx_mbnode_weak_notify(gpointer data, GObject *where_the_object_was)
+{
+    BalsaIndex *bindex = data;
+    bindex->mailbox_node = NULL;
+    gtk_widget_destroy(GTK_WIDGET(bindex));
+}
+
+static void
 bndx_destroy(GtkObject * obj)
 {
     BalsaIndex *index;
@@ -220,15 +228,17 @@ bndx_destroy(GtkObject * obj)
             gdk_threads_leave();
 	    libbalsa_mailbox_close(mailbox, balsa_app.expunge_on_close);
             gdk_threads_enter();
-
-	    libbalsa_mailbox_search_iter_free(index->search_iter);
-	    index->search_iter = NULL;
 	}
 	g_object_weak_unref(G_OBJECT(index->mailbox_node),
-			    (GWeakNotify) gtk_widget_destroy, index);
+                            (GWeakNotify) bndx_mbnode_weak_notify, index);
 	index->mailbox_node = NULL;
     }
 
+    if (index->search_iter) {
+        libbalsa_mailbox_search_iter_free(index->search_iter);
+        index->search_iter = NULL;
+    }
+
     if (index->popup_menu) {
         g_object_unref(index->popup_menu);
         index->popup_menu = NULL;
@@ -1019,7 +1029,7 @@ balsa_index_load_mailbox_node (BalsaIndex * index,
      */
     index->mailbox_node = mbnode;
     g_object_weak_ref(G_OBJECT(mbnode),
-		      (GWeakNotify) gtk_widget_destroy, index);
+                      (GWeakNotify) bndx_mbnode_weak_notify, index);
     /*
      * rename "from" column to "to" for outgoing mail
      */



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