1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-16 05:11:49 -05:00

Do not create a Message if there is no worker to send to

Prevents memory leaks.
This commit is contained in:
Daniele Forsi 2024-05-04 17:42:40 +02:00
parent 8829df3c3b
commit 461a79439b
3 changed files with 11 additions and 12 deletions

View File

@ -189,10 +189,10 @@ void PERTester::applySettings(const PERTesterSettings& settings, const QList<QSt
{ {
qDebug() << "PERTester::applySettings:" << settings.getDebugString(settingsKeys, force) << " force: " << force; qDebug() << "PERTester::applySettings:" << settings.getDebugString(settingsKeys, force) << " force: " << force;
if (m_worker) {
PERTesterWorker::MsgConfigurePERTesterWorker *msg = PERTesterWorker::MsgConfigurePERTesterWorker::create( PERTesterWorker::MsgConfigurePERTesterWorker *msg = PERTesterWorker::MsgConfigurePERTesterWorker::create(
settings, settingsKeys, force settings, settingsKeys, force
); );
if (m_worker) {
m_worker->getInputMessageQueue()->push(msg); m_worker->getInputMessageQueue()->push(msg);
} }

View File

@ -208,11 +208,10 @@ void SatelliteTracker::applySettings(const SatelliteTrackerSettings& settings, c
tlesChanged = true; tlesChanged = true;
} }
if (m_worker) {
SatelliteTrackerWorker::MsgConfigureSatelliteTrackerWorker *msg = SatelliteTrackerWorker::MsgConfigureSatelliteTrackerWorker::create( SatelliteTrackerWorker::MsgConfigureSatelliteTrackerWorker *msg = SatelliteTrackerWorker::MsgConfigureSatelliteTrackerWorker::create(
settings, settingsKeys, force settings, settingsKeys, force
); );
if (m_worker) {
m_worker->getInputMessageQueue()->push(msg); m_worker->getInputMessageQueue()->push(msg);
} }

View File

@ -163,9 +163,9 @@ bool StarTracker::handleMessage(const Message& cmd)
} }
else if (MsgSetSolarFlux::match(cmd)) else if (MsgSetSolarFlux::match(cmd))
{ {
if (m_worker) {
MsgSetSolarFlux& msg = (MsgSetSolarFlux&) cmd; MsgSetSolarFlux& msg = (MsgSetSolarFlux&) cmd;
m_solarFlux = msg.getFlux(); m_solarFlux = msg.getFlux();
if (m_worker) {
m_worker->getInputMessageQueue()->push(new MsgSetSolarFlux(msg)); m_worker->getInputMessageQueue()->push(new MsgSetSolarFlux(msg));
} }
return true; return true;
@ -246,10 +246,10 @@ void StarTracker::applySettings(const StarTrackerSettings& settings, const QList
} }
} }
if (m_worker) {
StarTrackerWorker::MsgConfigureStarTrackerWorker *msg = StarTrackerWorker::MsgConfigureStarTrackerWorker::create( StarTrackerWorker::MsgConfigureStarTrackerWorker *msg = StarTrackerWorker::MsgConfigureStarTrackerWorker::create(
settings, settingsKeys, force settings, settingsKeys, force
); );
if (m_worker) {
m_worker->getInputMessageQueue()->push(msg); m_worker->getInputMessageQueue()->push(msg);
} }