changeset 19592:cf3fdf335484

quota-clone: Fixed update-recursion crash when closing mailbox. We need to avoid recursing for all mailboxes that quota recalculation might open and close, not just the one that triggered the recalculation.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Tue, 19 Jan 2016 15:11:44 +0200
parents effb67b92547
children 51a4c305a087
files src/plugins/quota-clone/quota-clone-plugin.c
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/quota-clone/quota-clone-plugin.c	Tue Jan 19 02:30:53 2016 +0200
+++ b/src/plugins/quota-clone/quota-clone-plugin.c	Tue Jan 19 15:11:44 2016 +0200
@@ -24,12 +24,12 @@
 struct quota_clone_user {
 	union mail_user_module_context module_ctx;
 	struct dict *dict;
+	bool quota_flushing;
 };
 
 struct quota_clone_mailbox {
 	union mailbox_module_context module_ctx;
 	bool quota_changed;
-	bool quota_flushing;
 };
 
 static void quota_clone_flush(struct mailbox *box)
@@ -113,15 +113,17 @@
 static void quota_clone_mailbox_close(struct mailbox *box)
 {
 	struct quota_clone_mailbox *qbox = QUOTA_CLONE_CONTEXT(box);
+	struct quota_clone_user *quser =
+		QUOTA_CLONE_USER_CONTEXT(box->storage->user);
 
 	qbox->module_ctx.super.close(box);
 
-	if (qbox->quota_flushing) {
+	if (quser->quota_flushing) {
 		/* recursing back from quota recalculation */
 	} else if (qbox->quota_changed) {
-		qbox->quota_flushing = TRUE;
+		quser->quota_flushing = TRUE;
 		quota_clone_flush(box);
-		qbox->quota_flushing = FALSE;
+		quser->quota_flushing = FALSE;
 	}
 }