diff options
author | Oliver Wolff <oliver.wolff@qt.io> | 2018-03-27 14:07:10 +0200 |
---|---|---|
committer | Oliver Wolff <oliver.wolff@qt.io> | 2018-04-09 06:48:50 +0000 |
commit | 8342382e238fd7d70e356cf69e4399fee85848d9 (patch) | |
tree | 6128e0c87f6044ff315efa2f0b5fc1bc9bf38033 /src/winmain | |
parent | 4e74494c7e3e80206221c3a70fc2338107b68c7c (diff) |
qtmain_winrt: Synchronize debug message calls
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 <miguel.costa@qt.io>
Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Diffstat (limited to 'src/winmain')
-rw-r--r-- | src/winmain/qtmain_winrt.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
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); } |