From 26f01431ff24facfe8c3ed0b5f1ac8c277054e35 Mon Sep 17 00:00:00 2001 From: Jaime Bernardo Date: Wed, 2 Feb 2022 11:06:32 +0000 Subject: [PATCH] [MouseUtils]check queue dispatcher initialization (#15948) --- src/modules/MouseUtils/FindMyMouse/FindMyMouse.cpp | 6 ++++++ .../MousePointerCrosshairs/InclusiveCrosshairs.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/modules/MouseUtils/FindMyMouse/FindMyMouse.cpp b/src/modules/MouseUtils/FindMyMouse/FindMyMouse.cpp index c3893ef726..0897ab7fad 100644 --- a/src/modules/MouseUtils/FindMyMouse/FindMyMouse.cpp +++ b/src/modules/MouseUtils/FindMyMouse/FindMyMouse.cpp @@ -598,6 +598,12 @@ public: else { // Runtime objects already created. Should update in the owner thread. + if (m_dispatcherQueueController == nullptr) + { + Logger::warn("Tried accessing the dispatch queue controller before it was initialized."); + // No dispatcher Queue Controller? Means initialization still hasn't run, so settings will be applied then. + return; + } auto dispatcherQueue = m_dispatcherQueueController.DispatcherQueue(); FindMyMouseSettings localSettings = settings; bool enqueueSucceeded = dispatcherQueue.TryEnqueue([=]() { diff --git a/src/modules/MouseUtils/MousePointerCrosshairs/InclusiveCrosshairs.cpp b/src/modules/MouseUtils/MousePointerCrosshairs/InclusiveCrosshairs.cpp index c71a98bb0a..944c7a4055 100644 --- a/src/modules/MouseUtils/MousePointerCrosshairs/InclusiveCrosshairs.cpp +++ b/src/modules/MouseUtils/MousePointerCrosshairs/InclusiveCrosshairs.cpp @@ -277,6 +277,12 @@ void InclusiveCrosshairs::ApplySettings(InclusiveCrosshairsSettings& settings, b if (applyToRunTimeObjects) { // Runtime objects already created. Should update in the owner thread. + if (m_dispatcherQueueController == nullptr) + { + Logger::warn("Tried accessing the dispatch queue controller before it was initialized."); + // No dispatcher Queue Controller? Means initialization still hasn't run, so settings will be applied then. + return; + } auto dispatcherQueue = m_dispatcherQueueController.DispatcherQueue(); InclusiveCrosshairsSettings localSettings = settings; bool enqueueSucceeded = dispatcherQueue.TryEnqueue([=]() {