From 47ecc0ce29a802974dedbb341abc7560cf7a89ef Mon Sep 17 00:00:00 2001 From: James Turner Date: Mon, 21 Oct 2013 23:36:52 +0100 Subject: [PATCH] Fix an MSVC debug crash. Ensure the route-manger unregisters itself from the flightplan on destruction, since it is a delegate. --- src/Autopilot/route_mgr.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Autopilot/route_mgr.cxx b/src/Autopilot/route_mgr.cxx index 71dddb30b..fd46f4be7 100644 --- a/src/Autopilot/route_mgr.cxx +++ b/src/Autopilot/route_mgr.cxx @@ -234,6 +234,10 @@ FGRouteMgr::~FGRouteMgr() input->removeChangeListener(listener); delete listener; + if (_plan) { + _plan->removeDelegate(this); + } + //SGCommandMgr* cmdMgr = SGCommandMgr::instance(); //cmdMgr->removeCommand("define-user-waypoint");