From bdbe9e1ca5f3b3bb4bb0571777320f7392ef28c0 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Mon, 27 Jan 2020 23:45:45 +0300 Subject: [PATCH] fix(python): add more checks for _thread_quitflag --- python/src/deltachat/account.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/python/src/deltachat/account.py b/python/src/deltachat/account.py index 005ebfa59..77e1d53fd 100644 --- a/python/src/deltachat/account.py +++ b/python/src/deltachat/account.py @@ -605,23 +605,28 @@ class IOThreads: self._log_event("py-bindings-info", 0, "MVBOX THREAD START") while not self._thread_quitflag: lib.dc_perform_mvbox_jobs(self._dc_context) - lib.dc_perform_mvbox_fetch(self._dc_context) - lib.dc_perform_mvbox_idle(self._dc_context) + if not self._thread_quitflag: + lib.dc_perform_mvbox_fetch(self._dc_context) + if not self._thread_quitflag: + lib.dc_perform_mvbox_idle(self._dc_context) self._log_event("py-bindings-info", 0, "MVBOX THREAD FINISHED") def sentbox_thread_run(self): self._log_event("py-bindings-info", 0, "SENTBOX THREAD START") while not self._thread_quitflag: lib.dc_perform_sentbox_jobs(self._dc_context) - lib.dc_perform_sentbox_fetch(self._dc_context) - lib.dc_perform_sentbox_idle(self._dc_context) + if not self._thread_quitflag: + lib.dc_perform_sentbox_fetch(self._dc_context) + if not self._thread_quitflag: + lib.dc_perform_sentbox_idle(self._dc_context) self._log_event("py-bindings-info", 0, "SENTBOX THREAD FINISHED") def smtp_thread_run(self): self._log_event("py-bindings-info", 0, "SMTP THREAD START") while not self._thread_quitflag: lib.dc_perform_smtp_jobs(self._dc_context) - lib.dc_perform_smtp_idle(self._dc_context) + if not self._thread_quitflag: + lib.dc_perform_smtp_idle(self._dc_context) self._log_event("py-bindings-info", 0, "SMTP THREAD FINISHED")