mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
Issue #134 Fix double free crash on exit
The destructor of CThreadedTonePairPlayer was called twice: - after the local stack-variable of CSelcalPlayer got out of scope. - again as part of the CContinuousWorker/DeferredDelete
This commit is contained in:
committed by
Mat Sutcliffe
parent
154a1c803f
commit
594f589a64
@@ -18,9 +18,9 @@ namespace BlackSound
|
||||
{
|
||||
CSelcalPlayer::CSelcalPlayer(const CAudioDeviceInfo &device, QObject *parent)
|
||||
: QObject(parent),
|
||||
m_threadedPlayer(this, "CSelcalPlayer", device)
|
||||
m_threadedPlayer(new CThreadedTonePairPlayer(this, "CSelcalPlayer", device))
|
||||
{
|
||||
m_threadedPlayer.start();
|
||||
m_threadedPlayer->start();
|
||||
}
|
||||
|
||||
CSelcalPlayer::~CSelcalPlayer()
|
||||
@@ -30,7 +30,7 @@ namespace BlackSound
|
||||
|
||||
void CSelcalPlayer::gracefulShutdown()
|
||||
{
|
||||
m_threadedPlayer.quitAndWait();
|
||||
m_threadedPlayer->quitAndWait();
|
||||
}
|
||||
|
||||
CTime CSelcalPlayer::play(int volume, const CSelcal &selcal)
|
||||
@@ -46,7 +46,7 @@ namespace BlackSound
|
||||
const CTonePair t3(frequencies.at(2), frequencies.at(3), oneSec);
|
||||
QList<CTonePair> tonePairs;
|
||||
tonePairs << t1 << t2 << t3;
|
||||
m_threadedPlayer.play(volume, tonePairs);
|
||||
m_threadedPlayer->play(volume, tonePairs);
|
||||
duration = oneSec * 2.5;
|
||||
}
|
||||
return duration;
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace BlackSound
|
||||
BlackMisc::PhysicalQuantities::CTime play(int volume, const BlackMisc::Aviation::CSelcal &selcal);
|
||||
|
||||
private:
|
||||
CThreadedTonePairPlayer m_threadedPlayer;
|
||||
CThreadedTonePairPlayer *m_threadedPlayer = nullptr;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user