Re: trying to add a feature

Hi Ivan:

That sounds like an interesting hack^H^H^H^Hfeature!

I believe that the condition you're hitting could arise if you move mail into a mailbox that has at some time been in Balsa's mailbox tree but is not currently. That might happen if it's at a deeper level of the directory tree than is currently scanned, or if it has been recreated after Balsa started. In any case, asserting that it can't happen seems like overkill!

I believe the purpose of the assertion is to avoid replacing an existing view structure with a fresh one; the attached patch takes a more relaxed approach. Could you see if it helps?


On 10/11/2007 01:04:52 PM Thu, Ivan Avramovic wrote:

I've been trying to hack the balsa source to add a feature that would
be useful to me.  The feature is a save option, which will
automatically move the selected messages to local folders who's names
are determined by the email from-address in the message.

In its current state, the button will save messages to folders,
correctly.  However, invoking the option will cause balsa to
periodically crash, with the following error message:

** ERROR **: file mailbox.c: line 2113 (lbm_get_view): assertion
failed: (g_hash_table_lookup(libbalsa_mailbox_view_table, mailbox->url)
== NULL)

The file mailbox.c isn't one that I've touched with my code.  It seems
as though I'm somehow leaving the mailboxes in an invalid state,
probably something to do with how I open the mailboxes (I created the
mailbox with libbalsa_mailbox_local_new, and called g_object_unref on
it when I was done).

If someone more familiar with the inner workings of balsa knows what is
going on, I would be appreciative.  The following is a backtrace, if it
would be useful:

#1  0xb6d537f5 in raise () from /lib/i686/cmov/
#2  0xb6d55181 in abort () from /lib/i686/cmov/
#3  0xb745e9f9 in g_logv () from /usr/lib/
#4  0xb745ea39 in g_log () from /usr/lib/
#5  0xb745eab6 in g_assert_warning () from /usr/lib/
#6  0x080e80aa in lbm_get_view (mailbox=0xb74e221c) at mailbox.c:2112
#7  0x080e80c6 in libbalsa_mailbox_set_mtime (mailbox=0x0,
    at mailbox.c:2327
#8  0x080faa92 in libbalsa_mailbox_mbox_check (mailbox=0x840a7a8)
    at mailbox_mbox.c:968
#9  0x080ebfec in libbalsa_mailbox_check (mailbox=0x840a7a8) at
#10 0x080ec122 in lbm_check_real (mailbox=0x840a7a8) at mailbox.c:4037
#11 0xb6e7646b in start_thread () from /lib/i686/cmov/
#12 0xb6dfc4de in clone () from /lib/i686/cmov/

-Ivan Avramovic

balsa-list mailing list
balsa-list gnome org

Index: libbalsa/mailbox.c
--- libbalsa/mailbox.c	(revision 7757)
+++ libbalsa/mailbox.c	(working copy)
@@ -2108,17 +2108,17 @@
 	return &libbalsa_mailbox_view_default;
     view = mailbox->view;
-    if (view)
-	return view;
+    if (!view) {
+        view =
+            g_hash_table_lookup(libbalsa_mailbox_view_table, mailbox->url);
+        if (!view) {
+            view = libbalsa_mailbox_view_new();
+            g_hash_table_insert(libbalsa_mailbox_view_table,
+                                g_strdup(mailbox->url), view);
+        }
+        mailbox->view = view;
+    }
-    g_assert(g_hash_table_lookup(libbalsa_mailbox_view_table, mailbox->url)
-	     == NULL);
-    view = libbalsa_mailbox_view_new();
-    mailbox->view = view;
-    g_hash_table_insert(libbalsa_mailbox_view_table, g_strdup(mailbox->url),
-			view);
     return view;

Attachment: pgpPX8FKeUl1U.pgp
Description: PGP signature

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