aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2016-03-02 23:07:20 -0800
committerGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2016-03-02 23:07:20 -0800
commit886aae2ab94c74a4d4c644c446f67d37a333c1f9 (patch)
treec6ea5eee0a9f0f0f6c6fe5e24fa095a5f2363ad5
parentc32070da4d05124db4f4f91a83e737747199ef54 (diff)
Fixed deadlock
-rwxr-xr-xsrc/async/imap/MCIMAPAsyncConnection.cpp4
-rwxr-xr-xsrc/core/imap/MCIMAPSession.cpp8
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()