From 344058baba2294784050adb91e0ca75cba8102bf Mon Sep 17 00:00:00 2001 From: James Turner Date: Tue, 23 Mar 2021 17:07:59 +0000 Subject: [PATCH] Avoid crash when early-exiting. This is a work-around, but suitable for back-porting to 2020.3 Sentry-Id: FLIGHTGEAR-37D --- src/Model/modelmgr.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Model/modelmgr.cxx b/src/Model/modelmgr.cxx index 142ff6a7b..3235f6190 100644 --- a/src/Model/modelmgr.cxx +++ b/src/Model/modelmgr.cxx @@ -208,7 +208,12 @@ FGModelMgr::bind () void FGModelMgr::unbind () { - _models->removeChangeListener(_listener.get()); + // work-around for FLIGHTGEAR-37D : crash when quitting during + // early startup + if (!_listener) { + _models->removeChangeListener(_listener.get()); + } + _listener.reset(); _models.clear(); }