From 4e74494c7e3e80206221c3a70fc2338107b68c7c Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 27 Mar 2018 14:05:35 +0200 Subject: qtmain_winrt: Protect debug message handler with mutex MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The code can be accessed from several threads and thus should be protected. Change-Id: I38c67c5d0f9b1658da1d0ae45d3ea79bbe4e8dff Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Miguel Costa Reviewed-by: Andre de la Rocha Reviewed-by: Maurice Kalinowski --- src/winmain/qtmain_winrt.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/winmain') diff --git a/src/winmain/qtmain_winrt.cpp b/src/winmain/qtmain_winrt.cpp index b072248603..57724b0d36 100644 --- a/src/winmain/qtmain_winrt.cpp +++ b/src/winmain/qtmain_winrt.cpp @@ -69,6 +69,7 @@ extern "C" { #include #include #include +#include #include #include @@ -92,6 +93,10 @@ static void devMessageHandler(QtMsgType type, const QMessageLogContext &context, { static HANDLE shmem = 0; static HANDLE event = 0; + + static QMutex messageMutex; + QMutexLocker locker(&messageMutex); + if (!shmem) shmem = CreateFileMappingFromApp(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 4096, L"qdebug-shmem"); if (!event) @@ -108,6 +113,7 @@ static void devMessageHandler(QtMsgType type, const QMessageLogContext &context, message.data(), (message.length() + 1) * sizeof(wchar_t)); UnmapViewOfFile(data); SetEvent(event); + locker.unlock(); defaultMessageHandler(type, context, message); } -- cgit v1.2.3