<<< Date Index >>>     <<< Thread Index >>>

Re: Patch for bug 1036



Committed.

On 2003-08-21 02:29:26 -0400, Dan Born wrote:
> From: Dan Born <dan@xxxxxxxxxxx>
> To: mutt-dev@xxxxxxxx
> Date: Thu, 21 Aug 2003 02:29:26 -0400
> Subject: Patch for bug 1036
> Mail-Followup-To: mutt-dev@xxxxxxxx
> X-Spam-Level: 
> 
> I've attached a patch for bug number 1036, as reported at
> 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.
> 
> -- 
> Dan Born

> Common subdirectories: mutt-1.4.1/contrib and mutt-danborn/contrib
> Common subdirectories: mutt-1.4.1/doc and mutt-danborn/doc
> Common subdirectories: mutt-1.4.1/imap and mutt-danborn/imap
> Common subdirectories: mutt-1.4.1/intl and mutt-danborn/intl
> Common subdirectories: mutt-1.4.1/m4 and mutt-danborn/m4
> Common subdirectories: mutt-1.4.1/po and mutt-danborn/po
> diff -u mutt-1.4.1/postpone.c mutt-danborn/postpone.c
> --- mutt-1.4.1/postpone.c     Wed Oct 31 04:20:38 2001
> +++ mutt-danborn/postpone.c   Thu Aug 21 01:59:40 2003
> @@ -23,6 +23,7 @@
>  #include "mime.h"
>  #include "mailbox.h"
>  #include "mapping.h"
> +#include "sort.h"
>  #ifdef USE_IMAP
>  #include "mx.h"
>  #include "imap.h"
> @@ -157,6 +158,7 @@
>    MUTTMENU *menu;
>    int i, done=0, r=-1;
>    char helpstr[SHORT_STRING];
> +  short orig_sort;
>  
>    menu = mutt_new_menu ();
>    menu->make_entry = post_entry;
> @@ -166,6 +168,12 @@
>    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))
> @@ -201,6 +209,7 @@
>      }
>    }
>  
> +  Sort = orig_sort;
>    mutt_menuDestroy (&menu);
>    return (r > -1 ? PostContext->hdrs[r] : NULL);
>  }


-- 
Thomas Roessler · Personal soap box at <http://log.does-not-exist.org/>.