Mercurial > dovecot > core-2.2
changeset 22365:b4c4eef825ba
virtual: Stop notifications only if they were started
Fixes Panic: file mail-storage.c: line 1950: assertion failed: (box->opened)
author | Aki Tuomi <aki.tuomi@dovecot.fi> |
---|---|
date | Tue, 18 Jul 2017 21:04:47 +0300 |
parents | cd3e74d1002f |
children | 85f3ae6b6bef |
files | src/plugins/virtual/virtual-storage.c src/plugins/virtual/virtual-storage.h |
diffstat | 2 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/virtual/virtual-storage.c Wed Jul 19 10:58:43 2017 +0300 +++ b/src/plugins/virtual/virtual-storage.c Tue Jul 18 21:04:47 2017 +0300 @@ -426,6 +426,12 @@ DLLIST2_REMOVE_FULL(&mbox->open_backend_boxes_head, &mbox->open_backend_boxes_tail, bbox, prev_open, next_open); + + /* stop receiving notifications */ + if (bbox->notify_changes_started) + mailbox_notify_changes_stop(bbox->box); + bbox->notify_changes_started = FALSE; + mailbox_close(bbox->box); } @@ -693,7 +699,10 @@ if (box->notify_callback == NULL) { array_foreach_modifiable(&mbox->backend_boxes, bboxp) { - mailbox_notify_changes_stop((*bboxp)->box); + if ((*bboxp)->notify_changes_started) { + mailbox_notify_changes_stop((*bboxp)->box); + (*bboxp)->notify_changes_started = FALSE; + } if ((*bboxp)->notify != NULL) mailbox_list_notify_deinit(&(*bboxp)->notify); } @@ -717,6 +726,7 @@ } mailbox_notify_changes((*bboxp)->box, virtual_notify_callback, box); + (*bboxp)->notify_changes_started = TRUE; } }
--- a/src/plugins/virtual/virtual-storage.h Wed Jul 19 10:58:43 2017 +0300 +++ b/src/plugins/virtual/virtual-storage.h Tue Jul 18 21:04:47 2017 +0300 @@ -114,6 +114,7 @@ unsigned int uids_nonsorted:1; unsigned int search_args_initialized:1; unsigned int deleted:1; + unsigned int notify_changes_started:1; /* if the box was opened for notify_changes */ }; ARRAY_DEFINE_TYPE(virtual_backend_box, struct virtual_backend_box *);