mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-08 12:45:35 +08:00
Connection guard (detected during #477)
Disconnects Qt signal/slot conenction when destroyed
This commit is contained in:
committed by
Mathew Sutcliffe
parent
3acf085b92
commit
23856bbc57
@@ -35,12 +35,14 @@ namespace BlackCore
|
||||
this->setObjectName("Simulator:" + info.getIdentifier());
|
||||
|
||||
// provider signals
|
||||
m_remoteAircraftProviderConnections = this->m_remoteAircraftProvider->connectRemoteAircraftProviderSignals(
|
||||
m_remoteAircraftProviderConnections.append(
|
||||
this->m_remoteAircraftProvider->connectRemoteAircraftProviderSignals(
|
||||
this, // receiver must match object in bind
|
||||
std::bind(&CSimulatorCommon::ps_remoteProviderAddAircraftSituation, this, std::placeholders::_1),
|
||||
std::bind(&CSimulatorCommon::ps_remoteProviderAddAircraftParts, this, std::placeholders::_1, std::placeholders::_2),
|
||||
std::bind(&CSimulatorCommon::ps_remoteProviderRemovedAircraft, this, std::placeholders::_1),
|
||||
std::bind(&CSimulatorCommon::ps_recalculateRenderedAircraft, this, std::placeholders::_1));
|
||||
std::bind(&CSimulatorCommon::ps_recalculateRenderedAircraft, this, std::placeholders::_1))
|
||||
);
|
||||
|
||||
// timer
|
||||
this->m_oneSecondTimer.setObjectName(this->objectName().append(":m_oneSecondTimer"));
|
||||
@@ -219,14 +221,7 @@ namespace BlackCore
|
||||
void CSimulatorCommon::unload()
|
||||
{
|
||||
this->disconnectFrom(); // disconnect from simulator
|
||||
|
||||
// disconnect as many signals as possible
|
||||
for (const QMetaObject::Connection &c : m_remoteAircraftProviderConnections)
|
||||
{
|
||||
QObject::disconnect(c);
|
||||
}
|
||||
m_remoteAircraftProviderConnections.clear();
|
||||
this->disconnect();
|
||||
this->m_remoteAircraftProviderConnections.disconnectAll();
|
||||
CLogHandler::instance()->disconnect();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user