Commit 3908c4d9 authored by Kevin J. McCarthy's avatar Kevin J. McCarthy

Don't modify LastFolder/CurrentFolder upon aborting a change folder operation.

Set LastFolder and CurrentFolder after mx_close_mailbox() has
successfully completed.  Otherwise, if the close is aborted, they will
have incorrect values.
parent 4b4049c8
......@@ -1238,7 +1238,6 @@ int mutt_index_menu (void)
mutt_error (_("%s is not a mailbox."), buf);
break;
}
mutt_str_replace (&CurrentFolder, buf);
/* keepalive failure in mutt_enter_fname may kill connection. #3028 */
if (Context && !Context->path)
......@@ -1247,13 +1246,14 @@ int mutt_index_menu (void)
if (Context)
{
int check;
char *new_last_folder;
#ifdef USE_COMPRESSED
if (Context->compress_info && Context->realpath)
mutt_str_replace (&LastFolder, Context->realpath);
new_last_folder = safe_strdup (Context->realpath);
else
#endif
mutt_str_replace (&LastFolder, Context->path);
new_last_folder = safe_strdup (Context->path);
oldcount = Context ? Context->msgcount : 0;
if ((check = mx_close_mailbox (Context, &index_hint)) != 0)
......@@ -1261,12 +1261,16 @@ int mutt_index_menu (void)
if (check == MUTT_NEW_MAIL || check == MUTT_REOPENED)
update_index (menu, Context, check, oldcount, index_hint);
FREE (&new_last_folder);
set_option (OPTSEARCHINVALID);
menu->redraw = REDRAW_INDEX | REDRAW_STATUS;
break;
}
FREE (&Context);
FREE (&LastFolder);
LastFolder = new_last_folder;
}
mutt_str_replace (&CurrentFolder, buf);
mutt_sleep (0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment