[MouseUtils]check queue dispatcher initialization (#15948)

This commit is contained in:
Jaime Bernardo
2022-02-02 11:06:32 +00:00
committed by GitHub
parent 55e3a94da3
commit 26f01431ff
2 changed files with 12 additions and 0 deletions

View File

@@ -598,6 +598,12 @@ public:
else else
{ {
// Runtime objects already created. Should update in the owner thread. // 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(); auto dispatcherQueue = m_dispatcherQueueController.DispatcherQueue();
FindMyMouseSettings localSettings = settings; FindMyMouseSettings localSettings = settings;
bool enqueueSucceeded = dispatcherQueue.TryEnqueue([=]() { bool enqueueSucceeded = dispatcherQueue.TryEnqueue([=]() {

View File

@@ -277,6 +277,12 @@ void InclusiveCrosshairs::ApplySettings(InclusiveCrosshairsSettings& settings, b
if (applyToRunTimeObjects) if (applyToRunTimeObjects)
{ {
// Runtime objects already created. Should update in the owner thread. // 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(); auto dispatcherQueue = m_dispatcherQueueController.DispatcherQueue();
InclusiveCrosshairsSettings localSettings = settings; InclusiveCrosshairsSettings localSettings = settings;
bool enqueueSucceeded = dispatcherQueue.TryEnqueue([=]() { bool enqueueSucceeded = dispatcherQueue.TryEnqueue([=]() {