···290290 imap_free_header_data ((IMAP_HEADER_DATA**)&h->data);
291291 }
292292 else
293293+ {
293294 h->index = i;
295295+ /* Mutt has several places where it turns off h->active as a
296296+ * hack. For example to avoid FLAG updates, or to exclude from
297297+ * imap_exec_msgset.
298298+ *
299299+ * Unfortunately, when a reopen is allowed and the IMAP_EXPUNGE_PENDING
300300+ * flag becomes set (e.g. a flag update to a modified header),
301301+ * this function will be called by imap_cmd_finish().
302302+ *
303303+ * The mx_update_tables() will free and remove these "inactive" headers,
304304+ * despite that an EXPUNGE was not received for them.
305305+ * This would result in memory leaks and segfaults due to dangling
306306+ * pointers in the msn_index and uid_hash.
307307+ *
308308+ * So this is another hack to work around the hacks. We don't want to
309309+ * remove the messages, so make sure active is on.
310310+ */
311311+ h->active = 1;
312312+ }
294313 }
295314296315#if USE_HCACHE
···16001619 {
16011620 /* Send commands to previous server. Sorting the buffy list
16021621 * may prevent some infelicitous interleavings */
16031603- if (imap_exec (lastdata, NULL, IMAP_CMD_FAIL_OK) == -1)
16221622+ if (imap_exec (lastdata, NULL, IMAP_CMD_FAIL_OK | IMAP_CMD_POLL) == -1)
16041623 dprint (1, (debugfile, "Error polling mailboxes\n"));
1605162416061625 lastdata = NULL;