1
0
Fork 0

Fix a use-after-free found by ASan.

This commit is contained in:
James Turner 2020-08-14 22:41:18 +01:00
parent 51173f32ff
commit 2295e82a0f
2 changed files with 10 additions and 0 deletions

View file

@ -267,6 +267,7 @@ void
GPS::unbind() GPS::unbind()
{ {
_tiedProperties.Untie(); _tiedProperties.Untie();
_gpsNode.clear();
} }
void void
@ -366,6 +367,14 @@ GPS::update (double delta_time_sec)
_lastPosValid = !(_last_pos == SGGeod()); _lastPosValid = !(_last_pos == SGGeod());
} }
void GPS::shutdown()
{
if (_route) {
_route->removeDelegate(this);
_route = nullptr;
}
}
void GPS::routeManagerFlightPlanChanged(SGPropertyNode*) void GPS::routeManagerFlightPlanChanged(SGPropertyNode*)
{ {
if (_route) { if (_route) {

View file

@ -70,6 +70,7 @@ public:
void bind() override; void bind() override;
void unbind() override; void unbind() override;
void update (double delta_time_sec) override; void update (double delta_time_sec) override;
void shutdown() override;
// Subsystem identification. // Subsystem identification.
static const char* staticSubsystemClassId() { return "gps"; } static const char* staticSubsystemClassId() { return "gps"; }