mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
Physically remove only physically rendered aircrafts
Physically removing an aircraft which was not yet rendered or known is undefined behavior. In this particular case, adding an aircraft the first time caused its model to be updated, which called slot ISimulator::changeRemoteAircraftModel, trying to remove an aircraft which was not yet added and adding it again. This ends up in an endless loop.
This commit is contained in:
@@ -109,7 +109,9 @@ namespace BlackSimPlugin
|
||||
bool CSimulatorFsCommon::changeRemoteAircraftModel(const CSimulatedAircraft &aircraft)
|
||||
{
|
||||
// remove upfront, and then enable / disable again
|
||||
this->physicallyRemoveRemoteAircraft(aircraft.getCallsign());
|
||||
auto callsign = aircraft.getCallsign();
|
||||
if (!isPhysicallyRenderedAircraft(callsign)) { return false; }
|
||||
this->physicallyRemoveRemoteAircraft(callsign);
|
||||
return this->changeRemoteAircraftEnabled(aircraft);
|
||||
}
|
||||
|
||||
|
||||
@@ -532,7 +532,9 @@ namespace BlackSimPlugin
|
||||
bool CSimulatorXPlane::changeRemoteAircraftModel(const CSimulatedAircraft &aircraft)
|
||||
{
|
||||
// remove upfront, and then enable / disable again
|
||||
this->physicallyRemoveRemoteAircraft(aircraft.getCallsign());
|
||||
auto callsign = aircraft.getCallsign();
|
||||
if (!isPhysicallyRenderedAircraft(callsign)) { return false; }
|
||||
this->physicallyRemoveRemoteAircraft(callsign);
|
||||
return this->changeRemoteAircraftEnabled(aircraft);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user