dovecot-2.1: lib-storage: Keep mail_user referenced while storag...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Oct 2 16:28:02 EEST 2011
details: http://hg.dovecot.org/dovecot-2.1/rev/b7995a25c052
changeset: 13580:b7995a25c052
user: Timo Sirainen <tss at iki.fi>
date: Sun Oct 02 16:34:41 2011 +0300
description:
lib-storage: Keep mail_user referenced while storage objects exist.
This allows unreferencing mail_user after mailbox_alloc() and having it
freed on mailbox_free().
diffstat:
src/lib-storage/mail-storage.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diffs (25 lines):
diff -r f41a3dd03be2 -r b7995a25c052 src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c Sun Oct 02 16:33:51 2011 +0300
+++ b/src/lib-storage/mail-storage.c Sun Oct 02 16:34:41 2011 +0300
@@ -419,7 +419,8 @@
{
i_assert(storage->refcount > 0);
- storage->obj_refcount++;
+ if (storage->obj_refcount++ == 0)
+ mail_user_ref(storage->user);
}
void mail_storage_obj_unref(struct mail_storage *storage)
@@ -427,7 +428,10 @@
i_assert(storage->refcount > 0);
i_assert(storage->obj_refcount > 0);
- storage->obj_refcount--;
+ if (--storage->obj_refcount == 0) {
+ struct mail_user *user = storage->user;
+ mail_user_unref(&user);
+ }
}
void mail_storage_clear_error(struct mail_storage *storage)
More information about the dovecot-cvs
mailing list