Mercurial > dovecot > core-2.2
changeset 13754:deaebb4dc98c
lib-storage: Track storage's all mailboxes to make it easier to debug if one isn't closed.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 23 Nov 2011 19:19:19 +0200 |
parents | 4f1d20b57c04 |
children | 0644361ca409 |
files | src/lib-storage/mail-storage-private.h src/lib-storage/mail-storage.c |
diffstat | 2 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/mail-storage-private.h Wed Nov 23 19:11:13 2011 +0200 +++ b/src/lib-storage/mail-storage-private.h Wed Nov 23 19:19:19 2011 +0200 @@ -78,6 +78,8 @@ /* 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; @@ -210,6 +212,8 @@ 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;
--- a/src/lib-storage/mail-storage.c Wed Nov 23 19:11:13 2011 +0200 +++ b/src/lib-storage/mail-storage.c Wed Nov 23 19:19:19 2011 +0200 @@ -412,6 +412,10 @@ 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"); @@ -627,6 +631,7 @@ hook_mailbox_allocated(box); } T_END; + DLLIST_PREPEND(&box->storage->mailboxes, box); mail_storage_obj_ref(box->storage); return box; } @@ -893,6 +898,8 @@ mailbox_close(box); box->v.free(box); + + DLLIST_REMOVE(&box->storage->mailboxes, box); mail_storage_obj_unref(box->storage); pool_unref(&box->pool); }