mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 21:56:43 +08:00
Guarding QTimer::singelShot operations, avoid to access dangling pointers
This commit is contained in:
committed by
Roland Winklmeier
parent
b5ba4013dd
commit
1b8383bee1
@@ -119,8 +119,10 @@ namespace BlackCore
|
||||
if (m_network && sApp && !sApp->isShuttingDown())
|
||||
{
|
||||
// thread safe update of m_network
|
||||
const QPointer<CAirspaceMonitor> guard(this);
|
||||
QTimer::singleShot(0, m_network, [ = ]
|
||||
{
|
||||
if (guard.isNull()) { return; }
|
||||
if (m_network) { m_network->addInterimPositionReceiver(callsign); }
|
||||
});
|
||||
}
|
||||
@@ -459,8 +461,10 @@ namespace BlackCore
|
||||
if (trial < 2 && !complete)
|
||||
{
|
||||
this->addReverseLookupMessage(callsign, "Wait for further data");
|
||||
const QPointer<CAirspaceMonitor> guard(this);
|
||||
QTimer::singleShot(1500, this, [ = ]()
|
||||
{
|
||||
if (guard.isNull()) { return; }
|
||||
this->sendReadyForModelMatching(callsign, trial + 1); // recursive
|
||||
});
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user