mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-30 14:15:35 +08:00
Ref T739, minor fixes (mutex, "myself")
This commit is contained in:
committed by
Mat Sutcliffe
parent
57ff07592a
commit
e3ed71a919
@@ -56,7 +56,12 @@ namespace BlackCore
|
|||||||
connect(m_voiceServerPositionTimer, &QTimer::timeout, this, &CAfvClient::onPositionUpdateTimer);
|
connect(m_voiceServerPositionTimer, &QTimer::timeout, this, &CAfvClient::onPositionUpdateTimer);
|
||||||
|
|
||||||
// deferred init
|
// deferred init
|
||||||
QTimer::singleShot(1000, this, &CAfvClient::deferredInit);
|
QPointer<CAfvClient> myself(this);
|
||||||
|
QTimer::singleShot(1000, this, [ = ]
|
||||||
|
{
|
||||||
|
if (!myself) { return; }
|
||||||
|
this->deferredInit();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CAfvClient::getCallsign() const
|
QString CAfvClient::getCallsign() const
|
||||||
@@ -372,6 +377,7 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
// in connection and soundcard only use the enabled tarnsceivers
|
// in connection and soundcard only use the enabled tarnsceivers
|
||||||
|
QMutexLocker lock(&m_mutex);
|
||||||
if (m_connection) { m_connection->updateTransceivers(callsign, newEnabledTransceivers); }
|
if (m_connection) { m_connection->updateTransceivers(callsign, newEnabledTransceivers); }
|
||||||
if (m_soundcardSampleProvider) { m_soundcardSampleProvider->updateRadioTransceivers(newEnabledTransceivers); }
|
if (m_soundcardSampleProvider) { m_soundcardSampleProvider->updateRadioTransceivers(newEnabledTransceivers); }
|
||||||
}
|
}
|
||||||
@@ -559,7 +565,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
if (! m_connection->isConnected()) { return; }
|
if (! m_connection->isConnected()) { return; }
|
||||||
|
|
||||||
const QString callsign = this->getCallsign();
|
const QString callsign = this->getCallsign(); // threadsafe
|
||||||
const auto transmittingTransceivers = this->getTransmittingTransceivers(); // threadsafe
|
const auto transmittingTransceivers = this->getTransmittingTransceivers(); // threadsafe
|
||||||
if (transmittingTransceivers.size() > 0)
|
if (transmittingTransceivers.size() > 0)
|
||||||
{
|
{
|
||||||
@@ -592,7 +598,7 @@ namespace BlackCore
|
|||||||
m_connection->sendToVoiceServer(dto);
|
m_connection->sendToVoiceServer(dto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_transmitHistory = transmit;
|
m_transmitHistory = transmit; // threadsafe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -640,6 +646,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
bool CAfvClient::updateVoiceServerUrl(const QString &url)
|
bool CAfvClient::updateVoiceServerUrl(const QString &url)
|
||||||
{
|
{
|
||||||
|
QMutexLocker lock(&m_mutex);
|
||||||
if (!m_connection) { return false; }
|
if (!m_connection) { return false; }
|
||||||
return m_connection->updateVoiceServerUrl(url);
|
return m_connection->updateVoiceServerUrl(url);
|
||||||
}
|
}
|
||||||
@@ -810,7 +817,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
QMutexLocker lock(&m_mutex);
|
QMutexLocker lock(&m_mutex);
|
||||||
m_outputVolumeDb = valueDb;
|
m_outputVolumeDb = valueDb;
|
||||||
m_outputVolume = qPow(10, m_outputVolumeDb / 20.0);
|
m_outputVolume = qPow(10, m_outputVolumeDb / 20.0);
|
||||||
|
|
||||||
if (m_outputSampleProvider)
|
if (m_outputSampleProvider)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user