summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/VKontakte/src')
-rw-r--r--protocols/VKontakte/src/vk_proto.h3
-rw-r--r--protocols/VKontakte/src/vk_queue.cpp7
-rw-r--r--protocols/VKontakte/src/vk_status.cpp3
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp6
4 files changed, 12 insertions, 7 deletions
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h
index ecd9dd6869..0ad602b9c5 100644
--- a/protocols/VKontakte/src/vk_proto.h
+++ b/protocols/VKontakte/src/vk_proto.h
@@ -202,7 +202,8 @@ private:
mir_cs
m_csChatTyping,
m_csLoadHistoryTask,
- m_csRequestsQueue;
+ m_csRequestsQueue,
+ m_csSetStatus;
int m_iLoadHistoryTask;
diff --git a/protocols/VKontakte/src/vk_queue.cpp b/protocols/VKontakte/src/vk_queue.cpp
index 78e70c0049..515f7ad80b 100644
--- a/protocols/VKontakte/src/vk_queue.cpp
+++ b/protocols/VKontakte/src/vk_queue.cpp
@@ -172,12 +172,15 @@ void CVkProto::WorkerThread(void*)
}
}
- if (m_hAPIConnection)
+ if (m_hAPIConnection) {
+ debugLogA("CVkProto::WorkerThread: Netlib_CloseHandle(m_hAPIConnection) beg");
Netlib_CloseHandle(m_hAPIConnection);
+ debugLogA("CVkProto::WorkerThread: Netlib_CloseHandle(m_hAPIConnection) end");
+ }
m_hAPIConnection = NULL;
m_hWorkerThread = 0;
- debugLogA("CVkProto::WorkerThread: leaving");
+ debugLogA("CVkProto::WorkerThread: leaving m_bTerminated = %d", m_bTerminated ? 1 : 0);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/VKontakte/src/vk_status.cpp b/protocols/VKontakte/src/vk_status.cpp
index 7932ca21d3..ef7d83b874 100644
--- a/protocols/VKontakte/src/vk_status.cpp
+++ b/protocols/VKontakte/src/vk_status.cpp
@@ -20,6 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
int CVkProto::SetStatus(int iNewStatus)
{
debugLogA("CVkProto::SetStatus iNewStatus = %d, m_iStatus = %d, m_iDesiredStatus = %d m_hWorkerThread = %d", iNewStatus, m_iStatus, m_iDesiredStatus, m_hWorkerThread == NULL ? 0 : 1);
+
+ mir_cslock lck(m_csSetStatus);
+
if (m_iDesiredStatus == iNewStatus || iNewStatus == ID_STATUS_IDLE)
return 0;
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp
index 3e51da9baa..2430e21a15 100644
--- a/protocols/VKontakte/src/vk_thread.cpp
+++ b/protocols/VKontakte/src/vk_thread.cpp
@@ -32,11 +32,9 @@ static char fieldsName[] = "id, first_name, last_name, photo_100, bdate, sex, ti
void CVkProto::ShutdownSession()
{
debugLogA("CVkProto::ShutdownSession");
- if (m_hWorkerThread) {
- m_bTerminated = true;
+ m_bTerminated = true;
+ if (m_hWorkerThread)
SetEvent(m_evRequestsQueue);
- }
-
OnLoggedOut();
}