From 1f03f19402266c63bbb7120f50caacf3f6f79a36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Sun, 21 Feb 2021 16:43:39 +0100 Subject: #25 Check for folder again while locking --- internal/imap/mailboxes.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'internal') diff --git a/internal/imap/mailboxes.go b/internal/imap/mailboxes.go index f1dc6c6..25bf087 100644 --- a/internal/imap/mailboxes.go +++ b/internal/imap/mailboxes.go @@ -26,6 +26,14 @@ func (mbs *mailboxes) unlocking(elem Folder) { func (mbs *mailboxes) locking(elem Folder) bool { mbs.mu.Lock() + + // check again, if the folder has been created in the meantime + _, ok := mbs.mb[elem.str] + if ok { + mbs.mu.Unlock() + return true + } + ch, ok := mbs.changeLocks[elem.str] if !ok { ch = make(chan struct{}) -- cgit v1.2.3