http://bugs.guug.de/db/pa/lmutt.html ("segfault when more than one
msg is postponed"). This is a patch against mutt 1.4.1.
As it was previously left, no one could reproduce it. The problem
occurs because sorting is disabled when opening the postponed
folder, but the Sort global variable still tells mutt to use
whatever sorting algorithm the $sort config option indicates.
Eventually, the code would get to mutt_messages_in_thread and try to
dereference a NULL thread object, causing the segfault.
#include "mime.h"
#include "mailbox.h"
#include "mapping.h"
+#include "sort.h"
#ifdef USE_IMAP
#include "mx.h"
#include "imap.h"
MUTTMENU *menu;
int i, done=0, r=-1;
char helpstr[SHORT_STRING];
+ short orig_sort;
menu = mutt_new_menu ();
menu->make_entry = post_entry;
menu->data = PostContext;
menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_POST, PostponeHelp);
+ /* The postponed mailbox is setup to have sorting disabled, but the global
+ * Sort variable may indicate something different. Sorting has to be
+ * disabled while the postpone menu is being displayed. */
+ orig_sort = Sort;
+ Sort = SORT_ORDER;
+
while (!done)
{
switch (i = mutt_menuLoop (menu))
}
}
+ Sort = orig_sort;
mutt_menuDestroy (&menu);
return (r > -1 ? PostContext->hdrs[r] : NULL);
}