From cae06a79b7451e9e8cb3bf34e9d0ca3b9359dc9e Mon Sep 17 00:00:00 2001 From: James Turner Date: Mon, 14 Sep 2020 11:04:53 +0100 Subject: [PATCH] Attempt to fix crash-on-exit seen for Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Can’t reproduce this crash but it’s happening for some users on Windows, so this should either fix it, or make the problem more obvious. Let’s see. https://sentry.io/organizations/flightgear/issues/1890563449 --- src/Main/globals.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Main/globals.cxx b/src/Main/globals.cxx index 650ff6f23..55b601ac0 100644 --- a/src/Main/globals.cxx +++ b/src/Main/globals.cxx @@ -249,6 +249,13 @@ FGGlobals::~FGGlobals() delete initial_waypoints; delete channellist; + // delete commands before we release the property root + // this avoids crash where commands might be storing a propery + // ref/pointer. + // see https://sentry.io/organizations/flightgear/issues/1890563449 + delete commands; + commands = nullptr; + simgear::PropertyObjectBase::setDefaultRoot(NULL); simgear::SGModelLib::resetPropertyRoot(); delete locale; @@ -258,7 +265,6 @@ FGGlobals::~FGGlobals() props.clear(); - delete commands; delete simgear::ResourceManager::instance(); }