From 45303e1b6458582ea9b2e239829bf0af6b68f58a Mon Sep 17 00:00:00 2001 From: LordGrey <48840279+Lord-Grey@users.noreply.github.com> Date: Sun, 19 Jul 2020 15:13:41 +0200 Subject: [PATCH] Fix "Timers cannot be stopped from another thread" during shutdown (#876) --- include/hyperion/PriorityMuxer.h | 2 +- libsrc/hyperion/Hyperion.cpp | 2 +- libsrc/hyperion/HyperionIManager.cpp | 2 +- libsrc/hyperion/PriorityMuxer.cpp | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/hyperion/PriorityMuxer.h b/include/hyperion/PriorityMuxer.h index 63ee0af7..7546b857 100644 --- a/include/hyperion/PriorityMuxer.h +++ b/include/hyperion/PriorityMuxer.h @@ -63,7 +63,7 @@ public: /// /// @param ledCount The number of leds /// - PriorityMuxer(int ledCount); + PriorityMuxer(int ledCount, QObject * parent); /// /// Destructor diff --git a/libsrc/hyperion/Hyperion.cpp b/libsrc/hyperion/Hyperion.cpp index fb422018..19af041c 100644 --- a/libsrc/hyperion/Hyperion.cpp +++ b/libsrc/hyperion/Hyperion.cpp @@ -46,7 +46,7 @@ Hyperion::Hyperion(const quint8& instance) , _componentRegister(this) , _ledString(hyperion::createLedString(getSetting(settings::LEDS).array(), hyperion::createColorOrder(getSetting(settings::DEVICE).object()))) , _imageProcessor(new ImageProcessor(_ledString, this)) - , _muxer(_ledString.leds().size()) + , _muxer(_ledString.leds().size(), this) , _raw2ledAdjustment(hyperion::createLedColorsAdjustment(_ledString.leds().size(), getSetting(settings::COLOR).object())) , _effectEngine(nullptr) , _messageForwarder(nullptr) diff --git a/libsrc/hyperion/HyperionIManager.cpp b/libsrc/hyperion/HyperionIManager.cpp index d22424be..58d7d17e 100644 --- a/libsrc/hyperion/HyperionIManager.cpp +++ b/libsrc/hyperion/HyperionIManager.cpp @@ -74,7 +74,7 @@ bool HyperionIManager::startInstance(const quint8& inst, const bool& block) if(!_runningInstances.contains(inst) && !_startQueue.contains(inst)) { QThread* hyperionThread = new QThread(); - hyperionThread->setObjectName("HyperionIManagerThread"); + hyperionThread->setObjectName("HyperionThread"); Hyperion* hyperion = new Hyperion(inst); hyperion->moveToThread(hyperionThread); // setup thread management diff --git a/libsrc/hyperion/PriorityMuxer.cpp b/libsrc/hyperion/PriorityMuxer.cpp index 2c7b13c4..fd53a41d 100644 --- a/libsrc/hyperion/PriorityMuxer.cpp +++ b/libsrc/hyperion/PriorityMuxer.cpp @@ -14,8 +14,8 @@ const int PriorityMuxer::LOWEST_PRIORITY = std::numeric_limits::max(); -PriorityMuxer::PriorityMuxer(int ledCount) - : QObject() +PriorityMuxer::PriorityMuxer(int ledCount, QObject * parent) + : QObject(parent) , _log(Logger::getInstance("HYPERION")) , _currentPriority(PriorityMuxer::LOWEST_PRIORITY) , _manualSelectedPriority(256)