From 78e33de8e5538235b06623bbeef0019d4fb320c8 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Wed, 16 Nov 2016 08:35:36 +0100 Subject: winrt: Check for sanity of variables in debug build Identified as potential issues by analyze mode. Change-Id: I3f7c63a2349f29cc3de7baa78157fec157b9e561 Reviewed-by: Oliver Wolff --- 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 e49817ada4..b0e70608f9 100644 --- a/src/winmain/qtmain_winrt.cpp +++ b/src/winmain/qtmain_winrt.cpp @@ -110,7 +110,12 @@ static void devMessageHandler(QtMsgType type, const QMessageLogContext &context, if (!event) event = CreateEventEx(NULL, L"qdebug-event", 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"); + void *data = MapViewOfFileFromApp(shmem, FILE_MAP_WRITE, 0, 4096); + Q_ASSERT_X(data, Q_FUNC_INFO, "Could not map file"); + memset(data, quint32(type), sizeof(quint32)); memcpy_s(static_cast(data) + 1, 4096 - sizeof(quint32), message.data(), (message.length() + 1) * sizeof(wchar_t)); @@ -179,6 +184,7 @@ public: app->core->Exit(); return res; }, this, CREATE_SUSPENDED, nullptr); + Q_ASSERT_X(mainThread, Q_FUNC_INFO, "Could not create Qt main thread"); HRESULT hr; ComPtr appStatics; -- cgit v1.2.3