summaryrefslogtreecommitdiffstats
path: root/mx.c
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>1998-09-22 18:13:12 +0000
committerThomas Roessler <roessler@does-not-exist.org>1998-09-22 18:13:12 +0000
commit44716e861e9c38c6771d2605e3c3b9db7ecc145a (patch)
treec9ecbf1d698fb4c9af56d0b0040e957fe9b4d09c /mx.c
parent940f31f67ffe4ec651c099c9bcd62b78d1189cc9 (diff)
Some fixes and code clean-ups.
Diffstat (limited to 'mx.c')
-rw-r--r--mx.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/mx.c b/mx.c
index a0d70a37..3522a07a 100644
--- a/mx.c
+++ b/mx.c
@@ -1144,10 +1144,9 @@ int mutt_reopen_mailbox (CONTEXT *ctx, int *index_hint)
Sort = old_sort;
}
- /* save the old headers */
- old_msgcount = ctx->msgcount;
- old_hdrs = ctx->hdrs;
-
+ old_hdrs = NULL;
+ old_msgcount = 0;
+
/* simulate a close */
hash_destroy (&ctx->id_hash, NULL);
hash_destroy (&ctx->subj_hash, NULL);
@@ -1156,10 +1155,15 @@ int mutt_reopen_mailbox (CONTEXT *ctx, int *index_hint)
{
for (i = 0; i < ctx->msgcount; i++)
mutt_free_header (&(ctx->hdrs[i])); /* nothing to do! */
- safe_free ((void **) &ctx->hdrs);
+ safe_free ((void **) &ctx->hdrs);
}
else
+ {
+ /* save the old headers */
+ old_msgcount = ctx->msgcount;
+ old_hdrs = ctx->hdrs;
ctx->hdrs = NULL;
+ }
ctx->hdrmax = 0; /* force allocation of new headers */
ctx->msgcount = 0;