mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 06:35:52 +08:00
Improved handling for "unexpected shutdown"
(such as DBus down/unavailable)
This commit is contained in:
committed by
Mathew Sutcliffe
parent
6640c84e63
commit
5323491eb9
@@ -27,6 +27,7 @@
|
||||
#include "blackmisc/pq/frequency.h"
|
||||
#include "blackmisc/pq/units.h"
|
||||
#include "blackmisc/sequence.h"
|
||||
#include "blackmisc/verify.h"
|
||||
#include "ui_cockpitcomcomponent.h"
|
||||
|
||||
#include <QDoubleSpinBox>
|
||||
@@ -251,13 +252,17 @@ namespace BlackGui
|
||||
|
||||
CSimulatedAircraft CCockpitComComponent::getOwnAircraft() const
|
||||
{
|
||||
Q_ASSERT(sGui->getIContextOwnAircraft());
|
||||
if (!sGui->getIContextOwnAircraft()) return CSimulatedAircraft();
|
||||
// unavailable context during shutdown possible
|
||||
// mostly when client runs with DBus, but DBus is down
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextOwnAircraft()) { return CSimulatedAircraft(); }
|
||||
return sGui->getIContextOwnAircraft()->getOwnAircraft();
|
||||
}
|
||||
|
||||
bool CCockpitComComponent::updateOwnCockpitInContext(const CSimulatedAircraft &ownAircraft)
|
||||
{
|
||||
// unavailable context during shutdown possible
|
||||
// mostly when client runs with DBus, but DBus is down
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextOwnAircraft()) { return false; }
|
||||
return sGui->getIContextOwnAircraft()->updateCockpit(ownAircraft.getCom1System(), ownAircraft.getCom2System(), ownAircraft.getTransponder(), identifier());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user