summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/request_queue.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-10-31 13:13:13 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-10-31 13:13:13 +0300
commit9437834f8f4d3abf32a8629747385d666c652084 (patch)
tree3756bbc3e4648bf539ab78a891697f9a4e89690f /protocols/SkypeWeb/src/request_queue.cpp
parentce8b02d7c3df822605392d3e8e6f817953af0864 (diff)
fixes #1011 (thread-unsafe code in SkypeWeb)
Diffstat (limited to 'protocols/SkypeWeb/src/request_queue.cpp')
-rw-r--r--protocols/SkypeWeb/src/request_queue.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/protocols/SkypeWeb/src/request_queue.cpp b/protocols/SkypeWeb/src/request_queue.cpp
index a2c125e0c4..84d725aba4 100644
--- a/protocols/SkypeWeb/src/request_queue.cpp
+++ b/protocols/SkypeWeb/src/request_queue.cpp
@@ -26,6 +26,11 @@ RequestQueue::RequestQueue(HNETLIBUSER _nlu) :
RequestQueue::~RequestQueue()
{
+ if (hRequestQueueThread) {
+ WaitForSingleObject(hRequestQueueThread, INFINITE);
+ hRequestQueueThread = nullptr;
+ }
+
requests.destroy();
}
@@ -92,8 +97,11 @@ unsigned int RequestQueue::WorkerThread(void *arg)
{
RequestQueue *queue = (RequestQueue*)arg;
- while (!queue->isTerminated) {
+ while (true) {
queue->hRequestQueueEvent.Wait();
+ if (queue->isTerminated)
+ break;
+
while (true) {
RequestQueueItem *item = NULL;
{