Launcher: fix some warnings, maybe a crash
Avoid binding loop warning, and change logic around re-starting the aircraft dirs scan, to hopefully clarify the crash Brendan and others are seeing.
This commit is contained in:
parent
e2135369ce
commit
40a85cae28
4 changed files with 16 additions and 8 deletions
|
@ -44,20 +44,20 @@ AddOnsController::AddOnsController(LauncherMainWindow *parent, LaunchConfig* con
|
|||
|
||||
m_sceneryPaths = new PathListModel(this);
|
||||
connect(m_sceneryPaths, &PathListModel::enabledPathsChanged, [this] () {
|
||||
m_sceneryPaths->saveToSettings("scenery-paths");
|
||||
m_sceneryPaths->saveToSettings("scenery-paths-v2");
|
||||
flightgear::launcherSetSceneryPaths();
|
||||
});
|
||||
m_sceneryPaths->loadFromSettings("scenery-paths");
|
||||
m_sceneryPaths->loadFromSettings("scenery-paths-v2");
|
||||
|
||||
m_aircraftPaths = new PathListModel(this);
|
||||
connect(m_aircraftPaths, &PathListModel::enabledPathsChanged, [this] () {
|
||||
m_aircraftPaths->saveToSettings("aircraft-paths");
|
||||
m_aircraftPaths->saveToSettings("aircraft-paths-v2");
|
||||
|
||||
auto aircraftCache = LocalAircraftCache::instance();
|
||||
aircraftCache->setPaths(m_aircraftPaths->enabledPaths());
|
||||
aircraftCache->scanDirs();
|
||||
});
|
||||
m_aircraftPaths->loadFromSettings("aircraft-paths");
|
||||
m_aircraftPaths->loadFromSettings("aircraft-paths-v2");
|
||||
|
||||
QSettings settings;
|
||||
int size = settings.beginReadArray("addon-modules");
|
||||
|
|
|
@ -253,6 +253,7 @@ public:
|
|||
{
|
||||
m_done = true;
|
||||
}
|
||||
|
||||
Q_SIGNALS:
|
||||
void addedItems();
|
||||
|
||||
|
@ -522,10 +523,15 @@ AircraftItemPtr LocalAircraftCache::findItemWithUri(QUrl aircraftUri) const
|
|||
void LocalAircraftCache::abandonCurrentScan()
|
||||
{
|
||||
if (m_scanThread) {
|
||||
// don't fire onScanFinished when the thread ends
|
||||
disconnect(m_scanThread.get(), &AircraftScanThread::finished, this,
|
||||
&LocalAircraftCache::onScanFinished);
|
||||
|
||||
m_scanThread->setDone();
|
||||
m_scanThread->wait(1000);
|
||||
if (!m_scanThread->wait(2000)) {
|
||||
qWarning() << Q_FUNC_INFO << "scan thread failed to terminate";
|
||||
}
|
||||
m_scanThread.reset();
|
||||
qWarning() << Q_FUNC_INFO << "current scan abandonded";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -404,7 +404,7 @@ void launcherSetSceneryPaths()
|
|||
// positions
|
||||
QSettings settings;
|
||||
// append explicit scenery paths
|
||||
Q_FOREACH(QString path, PathListModel::readEnabledPaths("scenery-paths")) {
|
||||
Q_FOREACH(QString path, PathListModel::readEnabledPaths("scenery-paths-v2")) {
|
||||
globals->append_fg_scenery(path.toStdString());
|
||||
}
|
||||
|
||||
|
|
|
@ -42,9 +42,11 @@ Item {
|
|||
anchors.left: parent.left
|
||||
height: parent.height
|
||||
onCheckedChanged: {
|
||||
if (model.enabled !== checked) {
|
||||
model.enabled = checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: pathDelegateHover
|
||||
|
|
Loading…
Reference in a new issue