Guard QTimer::singleShot

This commit is contained in:
Klaus Basan
2018-05-06 20:24:40 +02:00
committed by Roland Winklmeier
parent 3ecb7b1f94
commit 3f4cb7529c
4 changed files with 33 additions and 8 deletions

View File

@@ -38,6 +38,7 @@
#include <QThread>
#include <Qt>
#include <QtGlobal>
#include <QPointer>
using namespace BlackConfig;
using namespace BlackMisc;
@@ -68,12 +69,18 @@ namespace BlackCore
this->restoreSimulatorPlugins();
connect(&m_weatherManager, &CWeatherManager::weatherGridReceived, this, &CContextSimulator::weatherGridReceived);
// seems to be redundant, as changed sim will cause changed cache
// connect(&m_modelSetLoader, &CAircraftModelSetLoader::simulatorChanged, this, &CDigestSignal::modelSetChanged);
connect(&m_modelSetLoader, &CAircraftModelSetLoader::cacheChanged, this, &CContextSimulator::modelSetChanged);
// seems to be redundant, as changed simulator will cause changed cache
// connect(&m_modelSetLoader, &CAircraftModelSetLoader::simulatorChanged, this, &CDigestSignal::modelSetChanged);
// deferred init of last model set, if no other data are set in meantime
QTimer::singleShot(1250, this, &CContextSimulator::initByLastUsedModelSet);
const QPointer<CContextSimulator> myself(this);
QTimer::singleShot(1250, this, [ = ]
{
if (!myself) { return; }
this->initByLastUsedModelSet();
});
}
CContextSimulator *CContextSimulator::registerWithDBus(CDBusServer *server)