diff --git a/python/src/deltachat/account.py b/python/src/deltachat/account.py index 68b3d71b8..005ebfa59 100644 --- a/python/src/deltachat/account.py +++ b/python/src/deltachat/account.py @@ -578,6 +578,11 @@ class IOThreads: def stop(self, wait=False): self._thread_quitflag = True + + # Workaround for a race condition. Make sure that thread is + # not in between checking for quitflag and entering idle. + time.sleep(0.5) + lib.dc_interrupt_imap_idle(self._dc_context) lib.dc_interrupt_smtp_idle(self._dc_context) lib.dc_interrupt_mvbox_idle(self._dc_context)