From 7e398ffe0073db0a2a9b449009f65cdec8b0881b Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Fri, 4 Oct 2024 21:05:40 +0200 Subject: [PATCH 1/2] fix(streamer-mode): access timer from correct thread --- src/singletons/StreamerMode.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/singletons/StreamerMode.cpp b/src/singletons/StreamerMode.cpp index 67ca2d348b5..ca63316a119 100644 --- a/src/singletons/StreamerMode.cpp +++ b/src/singletons/StreamerMode.cpp @@ -281,24 +281,27 @@ void StreamerModePrivate::settingChanged(StreamerModeSetting value) } this->currentSetting_ = value; + // in all cases: timer_ must be invoked from the correct thread switch (this->currentSetting_) { case StreamerModeSetting::Disabled: { this->setEnabled(false); - this->timer_->stop(); + QMetaObject::invokeMethod(this->timer_, &QTimer::stop); } break; case StreamerModeSetting::Enabled: { this->setEnabled(true); - this->timer_->stop(); + QMetaObject::invokeMethod(this->timer_, &QTimer::stop); } break; case StreamerModeSetting::DetectStreamingSoftware: { - if (!this->timer_->isActive()) - { - this->timer_->start(20s); - this->check(); - } + QMetaObject::invokeMethod(this->timer_, [this] { + if (!this->timer_->isActive()) + { + this->timer_->start(20s); + this->check(); + } + }); } break; default: From 42918517a62e50be9839ef0ca0ef256aa4682770 Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Fri, 4 Oct 2024 21:07:04 +0200 Subject: [PATCH 2/2] chore: add to changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba3c188b96a..47cc16cf1a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -88,7 +88,7 @@ - Dev: Fixed benchmarks segfaulting on run. (#5559) - Dev: Refactored `MessageBuilder` to be a single class. (#5548) - Dev: Recent changes are now shown in the nightly release description. (#5553, #5554, #5593) -- Dev: The timer for `StreamerMode` is now destroyed on the correct thread. (#5571) +- Dev: The timer for `StreamerMode` is now destroyed on the correct thread. (#5571, #5624) - Dev: Cleanup some parts of the `magic_enum` adaptation for Qt. (#5587) - Dev: Refactored `static`s in headers to only be present once in the final app. (#5588) - Dev: Run benchmarks in CI. (#5610)