Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(streamer-mode): access timer from correct thread #5624

Merged
merged 2 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 10 additions & 7 deletions src/singletons/StreamerMode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading