Guarding QTimer::singelShot operations, avoid to access dangling pointers

This commit is contained in:
Klaus Basan
2018-04-14 23:16:55 +02:00
committed by Roland Winklmeier
parent b5ba4013dd
commit 1b8383bee1
10 changed files with 52 additions and 8 deletions

View File

@@ -87,9 +87,10 @@ namespace BlackGui
{
ui->comp_SimulatorSelector->setValue(simulator);
ui->le_Simulator->setText(simulator.toQString(true));
QTimer::singleShot(500, [this]()
const QPointer<CDbOwnModelSetComponent> guard(this);
QTimer::singleShot(500, [ = ]()
{
if (!sApp || sApp->isShuttingDown()) { return; }
if (guard.isNull() || !sApp || sApp->isShuttingDown()) { return; }
this->updateViewToCurrentModels();
});
}