]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Fully unreference indexes when deleting mailboxes.
authorTimo Sirainen <tss@iki.fi>
Sat, 25 Oct 2014 03:16:47 +0000 (06:16 +0300)
committerTimo Sirainen <tss@iki.fi>
Sat, 25 Oct 2014 03:16:47 +0000 (06:16 +0300)
src/lib-storage/index/index-storage.c

index ac2d0f56038541b12468ac899a88fd1f20dd0b3c..8cad978cc869720b92aedffe74b2515bcf51825d 100644 (file)
@@ -377,7 +377,7 @@ void index_storage_mailbox_close(struct mailbox *box)
        ibox->sync_last_check = 0;
 }
 
-void index_storage_mailbox_free(struct mailbox *box)
+static void index_storage_mailbox_unref_indexes(struct mailbox *box)
 {
        if (box->index_pvt != NULL)
                mail_index_alloc_cache_unref(&box->index_pvt);
@@ -385,6 +385,11 @@ void index_storage_mailbox_free(struct mailbox *box)
                mail_index_alloc_cache_unref(&box->index);
 }
 
+void index_storage_mailbox_free(struct mailbox *box)
+{
+       index_storage_mailbox_unref_indexes(box);
+}
+
 static void
 index_storage_mailbox_update_cache(struct mailbox *box,
                                   const struct mailbox_update *update)
@@ -730,6 +735,7 @@ int index_storage_mailbox_delete_post(struct mailbox *box)
           implementations if indexes are opened by another session, but
           that can't really be helped. */
        mailbox_close(box);
+       index_storage_mailbox_unref_indexes(box);
        mail_index_alloc_cache_destroy_unrefed();
 
        if (box->list->v.delete_mailbox(box->list, box->name) < 0) {