diff options
author | Hoa V. DINH <dinh.viet.hoa@gmail.com> | 2016-03-02 23:07:20 -0800 |
---|---|---|
committer | Hoa V. DINH <dinh.viet.hoa@gmail.com> | 2016-03-02 23:07:20 -0800 |
commit | 886aae2ab94c74a4d4c644c446f67d37a333c1f9 (patch) | |
tree | c6ea5eee0a9f0f0f6c6fe5e24fa095a5f2363ad5 | |
parent | c32070da4d05124db4f4f91a83e737747199ef54 (diff) |
Fixed deadlock
-rwxr-xr-x | src/async/imap/MCIMAPAsyncConnection.cpp | 4 | ||||
-rwxr-xr-x | src/core/imap/MCIMAPSession.cpp | 8 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/async/imap/MCIMAPAsyncConnection.cpp b/src/async/imap/MCIMAPAsyncConnection.cpp index 0dc29ee0..ff12c881 100755 --- a/src/async/imap/MCIMAPAsyncConnection.cpp +++ b/src/async/imap/MCIMAPAsyncConnection.cpp @@ -365,13 +365,13 @@ void IMAPAsyncConnection::setConnectionLogger(ConnectionLogger * logger) { pthread_mutex_lock(&mConnectionLoggerLock); mConnectionLogger = logger; - if (mConnectionLogger != NULL) { + pthread_mutex_unlock(&mConnectionLoggerLock); + if (logger != NULL) { mSession->setConnectionLogger(mInternalLogger); } else { mSession->setConnectionLogger(NULL); } - pthread_mutex_unlock(&mConnectionLoggerLock); } ConnectionLogger * IMAPAsyncConnection::connectionLogger() diff --git a/src/core/imap/MCIMAPSession.cpp b/src/core/imap/MCIMAPSession.cpp index b1632739..96c618a7 100755 --- a/src/core/imap/MCIMAPSession.cpp +++ b/src/core/imap/MCIMAPSession.cpp @@ -3996,7 +3996,13 @@ void IMAPSession::setConnectionLogger(ConnectionLogger * logger) ConnectionLogger * IMAPSession::connectionLogger() { - return mConnectionLogger; + ConnectionLogger * result; + + lockConnectionLogger(); + result = mConnectionLogger; + unlockConnectionLogger(); + + return result; } void IMAPSession::lockConnectionLogger() |