mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Delete QDBusServiceWatcher when unloading X-Plane driver.
Summary: When unloading a sim driver, first its threads are killed, then the driver object is destroyed. This means that when the `QDBusServiceWatcher` child object is destroyed, it deadlocks waiting for a thread that was already killed (T147). This change causes the `QDBusServiceWatcher` to be deleted before the driver is unloaded. Reviewers: #swift_pilot_client, kbasan, rwinklmeier Reviewed By: #swift_pilot_client, kbasan, rwinklmeier Subscribers: kbasan, jenkins Tags: #swift_pilot_client Differential Revision: https://dev.swift-project.org/D50
This commit is contained in:
@@ -113,6 +113,13 @@ namespace BlackSimPlugin
|
||||
resetData();
|
||||
}
|
||||
|
||||
void CSimulatorXPlane::unload()
|
||||
{
|
||||
CSimulatorCommon::unload();
|
||||
delete m_watcher;
|
||||
m_watcher = nullptr;
|
||||
}
|
||||
|
||||
// convert xplane squawk mode to swift squawk mode
|
||||
BlackMisc::Aviation::CTransponder::TransponderMode xpdrMode(int xplaneMode, bool ident)
|
||||
{
|
||||
@@ -255,7 +262,7 @@ namespace BlackSimPlugin
|
||||
connect(m_traffic, &CXSwiftBusTrafficProxy::installedModelsUpdated, this, &CSimulatorXPlane::ps_installedModelsUpdated);
|
||||
m_service->updateAirportsInRange();
|
||||
m_traffic->updateInstalledModels();
|
||||
m_watcher->setConnection(m_conn);
|
||||
if (m_watcher) { m_watcher->setConnection(m_conn); }
|
||||
loadCslPackages();
|
||||
emitSimulatorCombinedStatus();
|
||||
return true;
|
||||
@@ -276,7 +283,7 @@ namespace BlackSimPlugin
|
||||
}
|
||||
|
||||
m_conn = QDBusConnection { "default" };
|
||||
m_watcher->setConnection(m_conn);
|
||||
if (m_watcher) { m_watcher->setConnection(m_conn); }
|
||||
delete m_service;
|
||||
delete m_traffic;
|
||||
delete m_weather;
|
||||
@@ -290,7 +297,7 @@ namespace BlackSimPlugin
|
||||
void CSimulatorXPlane::ps_serviceUnregistered()
|
||||
{
|
||||
m_conn = QDBusConnection { "default" };
|
||||
m_watcher->setConnection(m_conn);
|
||||
if (m_watcher) { m_watcher->setConnection(m_conn); }
|
||||
delete m_service;
|
||||
delete m_traffic;
|
||||
delete m_weather;
|
||||
@@ -746,7 +753,7 @@ namespace BlackSimPlugin
|
||||
{
|
||||
if (m_watcher)
|
||||
{
|
||||
m_watcher->deleteLater();
|
||||
delete m_watcher;
|
||||
m_watcher = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@ namespace BlackSimPlugin
|
||||
virtual bool setTimeSynchronization(bool enable, const BlackMisc::PhysicalQuantities::CTime &offset) override;
|
||||
virtual BlackMisc::PhysicalQuantities::CTime getTimeSynchronizationOffset() const override { return BlackMisc::PhysicalQuantities::CTime(0, BlackMisc::PhysicalQuantities::CTimeUnit::hrmin()); }
|
||||
virtual bool setInterpolatorMode(BlackMisc::Simulation::CInterpolatorMulti::Mode mode, const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
virtual void unload() override;
|
||||
//! @}
|
||||
|
||||
//! Creates an appropriate dbus connection from the string describing it
|
||||
|
||||
Reference in New Issue
Block a user