From 105da1b0c35d6762865a56d10eaf2246716a11cb Mon Sep 17 00:00:00 2001 From: Ethan Glasser-Camp Date: Thu, 24 Mar 2011 14:51:10 -0400 Subject: [PATCH] Always logout() on imaplib2 objects, even during exceptions Without this, trying to Ctrl-C out of offlineimap will go into a hang. Signed-off-by: Ethan Glasser-Camp Reviewed-by: Sebastian Spaeth Signed-off-by: Nicolas Sebrecht --- Changelog.draft.rst | 2 ++ offlineimap/accounts.py | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Changelog.draft.rst b/Changelog.draft.rst index 0a85888..39490a1 100644 --- a/Changelog.draft.rst +++ b/Changelog.draft.rst @@ -19,6 +19,8 @@ Changes Bug Fixes --------- +* Fix hang when using Ctrl+C in some cases. + Pending for the next major release ================================== diff --git a/offlineimap/accounts.py b/offlineimap/accounts.py index 4903e39..7edfa37 100644 --- a/offlineimap/accounts.py +++ b/offlineimap/accounts.py @@ -265,10 +265,9 @@ class SyncableAccount(Account): mbnames.write() localrepos.forgetfolders() remoterepos.forgetfolders() + finally: localrepos.holdordropconnections() remoterepos.holdordropconnections() - finally: - pass hook = self.getconf('postsynchook', '') self.callhook(hook)