/* counting number of objects (e.g. mailbox) that have a pointer
to this storage. */
int obj_refcount;
+ /* Linked list of all mailboxes in the storage */
+ struct mailbox *mailboxes;
const char *unique_root_dir;
char *error_string;
struct mailbox_vfuncs v, *vlast;
/* private: */
pool_t pool;
+ /* Linked list of all mailboxes in this storage */
+ struct mailbox *prev, *next;
/* these won't be set until mailbox is opened: */
struct mail_index *index;
return;
}
+ if (storage->mailboxes != NULL) {
+ i_panic("Trying to deinit storage without freeing mailbox %s",
+ storage->mailboxes->vname);
+ }
if (storage->obj_refcount != 0)
i_panic("Trying to deinit storage before freeing its objects");
hook_mailbox_allocated(box);
} T_END;
+ DLLIST_PREPEND(&box->storage->mailboxes, box);
mail_storage_obj_ref(box->storage);
return box;
}
mailbox_close(box);
box->v.free(box);
+
+ DLLIST_REMOVE(&box->storage->mailboxes, box);
mail_storage_obj_unref(box->storage);
pool_unref(&box->pool);
}