From 8515846317a210746a8d8316c2f99c652b357802 Mon Sep 17 00:00:00 2001 From: Patrick Chin Date: Mon, 8 Jun 2020 19:17:35 +0100 Subject: [PATCH] MessageQueue write time to current message not the next --- winpr/libwinpr/utils/collections/MessageQueue.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/winpr/libwinpr/utils/collections/MessageQueue.c b/winpr/libwinpr/utils/collections/MessageQueue.c index d288c544f..d787f8ff3 100644 --- a/winpr/libwinpr/utils/collections/MessageQueue.c +++ b/winpr/libwinpr/utils/collections/MessageQueue.c @@ -100,12 +100,13 @@ BOOL MessageQueue_Dispatch(wMessageQueue* queue, wMessage* message) } CopyMemory(&(queue->array[queue->tail]), message, sizeof(wMessage)); - queue->tail = (queue->tail + 1) % queue->capacity; - queue->size++; message = &(queue->array[queue->tail]); message->time = GetTickCount64(); + queue->tail = (queue->tail + 1) % queue->capacity; + queue->size++; + if (queue->size > 0) SetEvent(queue->event);