diff options
author | Hoa V. DINH <dinh.viet.hoa@gmail.com> | 2014-02-28 10:38:15 -0800 |
---|---|---|
committer | Hoa V. DINH <dinh.viet.hoa@gmail.com> | 2014-02-28 10:38:15 -0800 |
commit | 3c294cdebce8d22f043720ee8afa2f6362e24b1b (patch) | |
tree | e8c76fb373ee8e0d86216cdc89f6ea7b6e61db74 /src/async/imap | |
parent | ef0724e96c23bb49c9dfee34db4d6dcc6f37dc99 (diff) |
Fixed #615: fixed issue with cancelling "perform after delay"
Diffstat (limited to 'src/async/imap')
-rwxr-xr-x | src/async/imap/MCIMAPAsyncConnection.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/async/imap/MCIMAPAsyncConnection.cc b/src/async/imap/MCIMAPAsyncConnection.cc index 738da0d1..0cf658c2 100755 --- a/src/async/imap/MCIMAPAsyncConnection.cc +++ b/src/async/imap/MCIMAPAsyncConnection.cc @@ -110,7 +110,7 @@ IMAPAsyncConnection::IMAPAsyncConnection() IMAPAsyncConnection::~IMAPAsyncConnection() { - cancelDelayedPerformMethod((Object::Method) &IMAPAsyncConnection::tryAutomaticDisconnectAfterDelay, NULL); + cancelDelayedPerformMethodOnDispatchQueue((Object::Method) &IMAPAsyncConnection::tryAutomaticDisconnectAfterDelay, NULL, dispatchQueue()); pthread_mutex_destroy(&mConnectionLoggerLock); MC_SAFE_RELEASE(mInternalLogger); MC_SAFE_RELEASE(mQueueCallback); @@ -554,7 +554,11 @@ unsigned int IMAPAsyncConnection::operationsCount() void IMAPAsyncConnection::runOperation(IMAPOperation * operation) { - cancelDelayedPerformMethod((Object::Method) &IMAPAsyncConnection::tryAutomaticDisconnectAfterDelay, NULL); + if (mScheduledAutomaticDisconnect) { + cancelDelayedPerformMethodOnDispatchQueue((Object::Method) &IMAPAsyncConnection::tryAutomaticDisconnectAfterDelay, NULL, dispatchQueue()); + mOwner->release(); + mScheduledAutomaticDisconnect = false; + } mQueue->addOperation(operation); } @@ -567,12 +571,12 @@ void IMAPAsyncConnection::tryAutomaticDisconnect() bool scheduledAutomaticDisconnect = mScheduledAutomaticDisconnect; if (scheduledAutomaticDisconnect) { - cancelDelayedPerformMethod((Object::Method) &IMAPAsyncConnection::tryAutomaticDisconnectAfterDelay, NULL); + cancelDelayedPerformMethodOnDispatchQueue((Object::Method) &IMAPAsyncConnection::tryAutomaticDisconnectAfterDelay, NULL, dispatchQueue()); } mOwner->retain(); mScheduledAutomaticDisconnect = true; - performMethodAfterDelay((Object::Method) &IMAPAsyncConnection::tryAutomaticDisconnectAfterDelay, NULL, 30); + performMethodOnDispatchQueueAfterDelay((Object::Method) &IMAPAsyncConnection::tryAutomaticDisconnectAfterDelay, NULL, dispatchQueue(), 15); if (scheduledAutomaticDisconnect) { mOwner->release(); |