Mercurial > dovecot > original-hg > dovecot-1.2
changeset 8286:f21c6ade6e7f HEAD
quota: Previous dict quota fix broke trash plugin.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 18 Oct 2008 14:54:06 +0300 |
parents | 95437a2d0136 |
children | 944f709797df |
files | src/plugins/quota/quota-storage.c |
diffstat | 1 files changed, 19 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/quota/quota-storage.c Sat Oct 18 13:58:03 2008 +0300 +++ b/src/plugins/quota/quota-storage.c Sat Oct 18 14:54:06 2008 +0300 @@ -254,20 +254,24 @@ return quota_check(ctx->transaction, ctx->dest_mail); } -static void quota_mailbox_sync_finish(struct quota_mailbox *qbox) +static void quota_mailbox_sync_cleanup(struct quota_mailbox *qbox) { if (array_is_created(&qbox->expunge_uids)) { array_clear(&qbox->expunge_uids); array_clear(&qbox->expunge_sizes); } - if (qbox->expunge_qt != NULL) { - if (qbox->expunge_qt->tmp_mail != NULL) { - mail_free(&qbox->expunge_qt->tmp_mail); - mailbox_transaction_rollback(&qbox->expunge_trans); - } + if (qbox->expunge_qt != NULL && qbox->expunge_qt->tmp_mail != NULL) { + mail_free(&qbox->expunge_qt->tmp_mail); + mailbox_transaction_rollback(&qbox->expunge_trans); + } +} + +static void quota_mailbox_sync_commit(struct quota_mailbox *qbox) +{ + quota_mailbox_sync_cleanup(qbox); + if (qbox->expunge_qt != NULL) (void)quota_transaction_commit(&qbox->expunge_qt); - } qbox->recalculate = FALSE; } @@ -283,8 +287,14 @@ if (qbox->module_ctx.super.sync_notify != NULL) qbox->module_ctx.super.sync_notify(box, uid, sync_type); - if (sync_type != MAILBOX_SYNC_TYPE_EXPUNGE || qbox->recalculate) + if (sync_type != MAILBOX_SYNC_TYPE_EXPUNGE || qbox->recalculate) { + if (uid == 0) { + /* free the transaction before view syncing begins, + otherwise it'll crash. */ + quota_mailbox_sync_cleanup(qbox); + } return; + } /* we're in the middle of syncing the mailbox, so it's a bad idea to try and get the message sizes at this point. Rely on sizes that @@ -338,7 +348,7 @@ /* update quota only after syncing is finished. the quota commit may recalculate the quota and cause all mailboxes to be synced, including the one we're already syncing. */ - quota_mailbox_sync_finish(qbox); + quota_mailbox_sync_commit(qbox); return ret; }