[AFV] CContextAudio::m_voiceClient is a raw pointer, and CAfvClient doesn't have a parent

This commit is contained in:
Mat Sutcliffe
2019-10-10 20:46:35 +01:00
parent 2468b2ee49
commit b929eb442a
4 changed files with 11 additions and 10 deletions

View File

@@ -38,8 +38,8 @@ namespace BlackCore
return cats;
}
CAfvClient::CAfvClient(const QString &apiServer, QObject *parent) :
CContinuousWorker(parent, "CAfvClient"),
CAfvClient::CAfvClient(const QString &apiServer, QObject *owner) :
CContinuousWorker(owner, "CAfvClient"),
m_connection(new CClientConnection(apiServer, this)),
m_input(new CInput(SampleRate, this)),
m_output(new Output(this)),

View File

@@ -63,7 +63,7 @@ namespace BlackCore
Q_ENUM(ConnectionStatus)
//! Ctor
CAfvClient(const QString &apiServer, QObject *parent = nullptr);
CAfvClient(const QString &apiServer, QObject *owner);
//! Dtor
virtual ~CAfvClient() override { this->stopAudio(); }

View File

@@ -46,11 +46,11 @@ namespace BlackCore
Q_ASSERT_X(m_voiceClient->owner() == this, Q_FUNC_INFO, "Wrong owner");
Q_ASSERT_X(!CThreadUtils::isApplicationThread(m_voiceClient->thread()), Q_FUNC_INFO, "Must NOT be in main thread");
connect(m_voiceClient.get(), &CAfvClient::outputVolumePeakVU, this, &IContextAudio::outputVolumePeakVU);
connect(m_voiceClient.get(), &CAfvClient::inputVolumePeakVU, this, &IContextAudio::inputVolumePeakVU);
connect(m_voiceClient.get(), &CAfvClient::receivingCallsignsChanged, this, &IContextAudio::receivingCallsignsChanged);
connect(m_voiceClient.get(), &CAfvClient::updatedFromOwnAircraftCockpit, this, &IContextAudio::updatedFromOwnAircraftCockpit);
connect(m_voiceClient.data(), &CAfvClient::ptt, this, &IContextAudio::ptt);
connect(m_voiceClient, &CAfvClient::outputVolumePeakVU, this, &IContextAudio::outputVolumePeakVU);
connect(m_voiceClient, &CAfvClient::inputVolumePeakVU, this, &IContextAudio::inputVolumePeakVU);
connect(m_voiceClient, &CAfvClient::receivingCallsignsChanged, this, &IContextAudio::receivingCallsignsChanged);
connect(m_voiceClient, &CAfvClient::updatedFromOwnAircraftCockpit, this, &IContextAudio::updatedFromOwnAircraftCockpit);
connect(m_voiceClient, &CAfvClient::ptt, this, &IContextAudio::ptt);
const CSettings as = m_audioSettings.getThreadLocal();
this->setVoiceOutputVolume(as.getOutVolume());
@@ -107,7 +107,8 @@ namespace BlackCore
{
m_voiceClient->stopAudio();
m_voiceClient->quitAndWait();
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(m_voiceClient.data()), Q_FUNC_INFO, "Needs to be back in current thread");
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(m_voiceClient), Q_FUNC_INFO, "Needs to be back in current thread");
m_voiceClient = nullptr;
}
QObject::disconnect(this);
}

View File

@@ -260,7 +260,7 @@ namespace BlackCore
BlackMisc::CSetting<Audio::TOutputDevice> m_outputDeviceSetting { this, &IContextAudio::changeDeviceSettings };
// AFV
QScopedPointer<Afv::Clients::CAfvClient> m_voiceClient;
Afv::Clients::CAfvClient *m_voiceClient = nullptr;
// Players
BlackSound::CSelcalPlayer *m_selcalPlayer = nullptr;