mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
Ref T259, only remove aircraft after data have been used, otherwise a dangling reference causes a crash
This commit is contained in:
@@ -651,24 +651,21 @@ namespace BlackSimPlugin
|
||||
|
||||
// really remove from simulator
|
||||
if (!m_xplaneAircraft.contains(callsign)) { return false; } // already fully removed or not yet added
|
||||
CXPlaneMPAircraft &xplaneAircraft = m_xplaneAircraft[callsign];
|
||||
|
||||
// avoid further data from simulator
|
||||
// this->stopRequestingDataForSimObject(simObject);
|
||||
|
||||
m_traffic->removePlane(callsign.asString());
|
||||
|
||||
m_xplaneAircraft.remove(callsign);
|
||||
|
||||
// mark in provider
|
||||
const bool updated = this->updateAircraftRendered(callsign, false);
|
||||
if (updated)
|
||||
{
|
||||
Q_ASSERT_X(m_xplaneAircraft.contains(callsign), Q_FUNC_INFO, "Aircraft removed");
|
||||
const CXPlaneMPAircraft &xplaneAircraft = m_xplaneAircraft[callsign];
|
||||
CSimulatedAircraft aircraft(xplaneAircraft.getAircraft());
|
||||
aircraft.setRendered(false);
|
||||
emit this->aircraftRenderingChanged(aircraft);
|
||||
}
|
||||
|
||||
m_traffic->removePlane(callsign.asString());
|
||||
m_xplaneAircraft.remove(callsign);
|
||||
|
||||
// bye
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -37,9 +37,9 @@
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QTimer>
|
||||
|
||||
class QDBusServiceWatcher;
|
||||
class QTimer;
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user