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

@@ -659,8 +659,10 @@ namespace BlackGui
{
if (ui->cb_Heavy->isChecked())
{
const QPointer<CFlightPlanComponent> guard(this);
QTimer::singleShot(10, this, [ = ]
{
if (guard.isNull()) { return; }
ui->cb_Tcas->setChecked(false);
this->buildPrefixIcaoSuffix();
});
@@ -671,8 +673,10 @@ namespace BlackGui
{
if (ui->cb_Tcas->isChecked())
{
const QPointer<CFlightPlanComponent> guard(this);
QTimer::singleShot(10, this, [ = ]
{
if (guard.isNull()) { return; }
ui->cb_Heavy->setChecked(false);
this->buildPrefixIcaoSuffix();
});