mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
Guarding QTimer::singelShot operations, avoid to access dangling pointers
This commit is contained in:
committed by
Roland Winklmeier
parent
b5ba4013dd
commit
1b8383bee1
@@ -69,7 +69,12 @@ namespace BlackGui
|
||||
bool CConfigurationWizard::event(QEvent *event)
|
||||
{
|
||||
if (event->type() != QEvent::EnterWhatsThisMode) { return QDialog::event(event); }
|
||||
QTimer::singleShot(0, this, [ = ] { sGui->showHelp(this); });
|
||||
const QPointer<CConfigurationWizard> guard(this);
|
||||
QTimer::singleShot(0, this, [ = ]
|
||||
{
|
||||
if (guard.isNull() || !sGui || sGui->isShuttingDown()) { return; }
|
||||
sGui->showHelp(this);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -50,7 +50,12 @@ namespace BlackGui
|
||||
|
||||
void CDownloadDialog::showAndStartDownloading()
|
||||
{
|
||||
QTimer::singleShot(0, this, [ = ] { ui->comp_Download->triggerDownloadingOfFiles(2500); });
|
||||
const QPointer<CDownloadDialog> guard(this);
|
||||
QTimer::singleShot(0, this, [ = ]
|
||||
{
|
||||
if (guard.isNull()) { return; }
|
||||
ui->comp_Download->triggerDownloadingOfFiles(2500);
|
||||
});
|
||||
this->show();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
@@ -218,7 +218,12 @@ namespace BlackGui
|
||||
if (reply == QMessageBox::Yes)
|
||||
{
|
||||
const CStatusMessage msg = CStatusMessage(this).info("Using existing file '%1'") << saveAsFile;
|
||||
QTimer::singleShot(100, this, [ = ] { this->downloadedXSwiftBusFile(msg); });
|
||||
const QPointer<CInstallXSwiftBusComponent> guard(this);
|
||||
QTimer::singleShot(100, this, [ = ]
|
||||
{
|
||||
if (guard.isNull()) { return; }
|
||||
this->downloadedXSwiftBusFile(msg);
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user