From 8342382e238fd7d70e356cf69e4399fee85848d9 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 27 Mar 2018 14:07:10 +0200 Subject: qtmain_winrt: Synchronize debug message calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When winrtrunner is used to debug winrt applications, debug messages should be acknowledged by winrtrunner. Otherwise it is possible, that 2 messages are sent (and their event set) before winrtrunner reacted. In this case the first message was lost and the second message shown twice. Change-Id: Ib1c6f87aad0c0da1761be5bf467edf8d4476c5e3 Reviewed-by: Miguel Costa Reviewed-by: Andre de la Rocha Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Maurice Kalinowski --- src/winmain/qtmain_winrt.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/winmain/qtmain_winrt.cpp') diff --git a/src/winmain/qtmain_winrt.cpp b/src/winmain/qtmain_winrt.cpp index 57724b0d36..f2964adef4 100644 --- a/src/winmain/qtmain_winrt.cpp +++ b/src/winmain/qtmain_winrt.cpp @@ -93,6 +93,7 @@ static void devMessageHandler(QtMsgType type, const QMessageLogContext &context, { static HANDLE shmem = 0; static HANDLE event = 0; + static HANDLE ackEvent = 0; static QMutex messageMutex; QMutexLocker locker(&messageMutex); @@ -101,6 +102,8 @@ static void devMessageHandler(QtMsgType type, const QMessageLogContext &context, shmem = CreateFileMappingFromApp(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 4096, L"qdebug-shmem"); if (!event) event = CreateEventEx(NULL, L"qdebug-event", 0, EVENT_ALL_ACCESS); + if (!ackEvent) + ackEvent = CreateEventEx(NULL, L"qdebug-event-ack", 0, EVENT_ALL_ACCESS); Q_ASSERT_X(shmem, Q_FUNC_INFO, "Could not create file mapping"); Q_ASSERT_X(event, Q_FUNC_INFO, "Could not create debug event"); @@ -113,6 +116,7 @@ static void devMessageHandler(QtMsgType type, const QMessageLogContext &context, message.data(), (message.length() + 1) * sizeof(wchar_t)); UnmapViewOfFile(data); SetEvent(event); + WaitForSingleObjectEx(ackEvent, INFINITE, false); locker.unlock(); defaultMessageHandler(type, context, message); } -- cgit v1.2.3