Fix a crash (race condition) closing the launcher
When local aircraft scanning is slow, we can end up clearing the locale while a scan is in progress, which crashes. Ensure we abandon any in-progress scan when closing the launcher. Sentry-Id: FLIGHTGEAR-CH
This commit is contained in:
parent
df42c6f026
commit
9776c56faa
3 changed files with 22 additions and 8 deletions
|
@ -578,6 +578,11 @@ LocalAircraftCache* LocalAircraftCache::instance()
|
|||
return static_cacheInstance.get();
|
||||
}
|
||||
|
||||
void LocalAircraftCache::reset()
|
||||
{
|
||||
static_cacheInstance.reset();
|
||||
}
|
||||
|
||||
LocalAircraftCache::LocalAircraftCache() :
|
||||
d(new AircraftCachePrivate)
|
||||
{
|
||||
|
|
|
@ -110,6 +110,7 @@ public:
|
|||
~LocalAircraftCache();
|
||||
|
||||
static LocalAircraftCache* instance();
|
||||
static void reset();
|
||||
|
||||
|
||||
void setPaths(QStringList paths);
|
||||
|
|
|
@ -53,13 +53,14 @@
|
|||
#include <simgear/package/Install.hxx>
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
|
||||
#include <Main/globals.hxx>
|
||||
#include <Main/fg_props.hxx>
|
||||
#include <Navaids/NavDataCache.hxx>
|
||||
#include <Navaids/navrecord.hxx>
|
||||
#include <Navaids/SHPParser.hxx>
|
||||
#include <Airports/airport.hxx>
|
||||
#include <Add-ons/AddonManager.hxx>
|
||||
#include <Airports/airport.hxx>
|
||||
#include <Main/fg_props.hxx>
|
||||
#include <Main/globals.hxx>
|
||||
#include <Main/sentryIntegration.hxx>
|
||||
#include <Navaids/NavDataCache.hxx>
|
||||
#include <Navaids/SHPParser.hxx>
|
||||
#include <Navaids/navrecord.hxx>
|
||||
|
||||
|
||||
#include <Main/fg_init.hxx>
|
||||
|
@ -68,10 +69,11 @@
|
|||
#include <Network/HTTPClient.hxx>
|
||||
#include <Viewer/WindowBuilder.hxx>
|
||||
|
||||
#include "LauncherMainWindow.hxx"
|
||||
#include "LaunchConfig.hxx"
|
||||
#include "UnitsModel.hxx"
|
||||
#include "LauncherMainWindow.hxx"
|
||||
#include "LocalAircraftCache.hxx"
|
||||
#include "PathListModel.hxx"
|
||||
#include "UnitsModel.hxx"
|
||||
|
||||
using namespace flightgear;
|
||||
using namespace simgear::pkg;
|
||||
|
@ -500,6 +502,10 @@ bool runLauncherDialog()
|
|||
return false; // quit
|
||||
}
|
||||
|
||||
// avoid a race-y crash on the locale, if a scan thread is
|
||||
// still running: this reset will cancel any running scan
|
||||
LocalAircraftCache::reset();
|
||||
|
||||
// don't set scenery paths twice
|
||||
globals->clear_fg_scenery();
|
||||
globals->get_locale()->clear();
|
||||
|
@ -533,6 +539,8 @@ static const char* static_lockFileDialog_Info =
|
|||
|
||||
LockFileDialogResult showLockFileDialog()
|
||||
{
|
||||
flightgear::addSentryBreadcrumb("showing lock-file dialog", "info");
|
||||
|
||||
QString title = qApp->translate("LockFileDialog", static_lockFileDialog_Title);
|
||||
QString text = qApp->translate("LockFileDialog", static_lockFileDialog_Text);
|
||||
QString infoText = qApp->translate("LockFileDialog", static_lockFileDialog_Info);
|
||||
|
|
Loading…
Add table
Reference in a new issue