mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 04:25:42 +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
@@ -396,6 +396,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
bool CApplication::hasWebDataServices() const
|
bool CApplication::hasWebDataServices() const
|
||||||
{
|
{
|
||||||
|
if (this->isShuttingDown()) { return false; } // service will not survive for long
|
||||||
return this->m_webDataServices;
|
return this->m_webDataServices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include "blackmisc/pq/frequency.h"
|
#include "blackmisc/pq/frequency.h"
|
||||||
#include "blackmisc/pq/units.h"
|
#include "blackmisc/pq/units.h"
|
||||||
#include "blackmisc/sequence.h"
|
#include "blackmisc/sequence.h"
|
||||||
|
#include "blackmisc/verify.h"
|
||||||
#include "ui_cockpitcomcomponent.h"
|
#include "ui_cockpitcomcomponent.h"
|
||||||
|
|
||||||
#include <QDoubleSpinBox>
|
#include <QDoubleSpinBox>
|
||||||
@@ -251,13 +252,17 @@ namespace BlackGui
|
|||||||
|
|
||||||
CSimulatedAircraft CCockpitComComponent::getOwnAircraft() const
|
CSimulatedAircraft CCockpitComComponent::getOwnAircraft() const
|
||||||
{
|
{
|
||||||
Q_ASSERT(sGui->getIContextOwnAircraft());
|
// unavailable context during shutdown possible
|
||||||
if (!sGui->getIContextOwnAircraft()) return CSimulatedAircraft();
|
// mostly when client runs with DBus, but DBus is down
|
||||||
|
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextOwnAircraft()) { return CSimulatedAircraft(); }
|
||||||
return sGui->getIContextOwnAircraft()->getOwnAircraft();
|
return sGui->getIContextOwnAircraft()->getOwnAircraft();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCockpitComComponent::updateOwnCockpitInContext(const CSimulatedAircraft &ownAircraft)
|
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());
|
return sGui->getIContextOwnAircraft()->updateCockpit(ownAircraft.getCom1System(), ownAircraft.getCom2System(), ownAircraft.getTransponder(), identifier());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -205,6 +205,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
canConnect = CNetworkUtils::canConnect(sharedUrl);
|
canConnect = CNetworkUtils::canConnect(sharedUrl);
|
||||||
allRowsHtml += rowHtml.arg(canConnect ? imgOk : imgFailed, urlLinkHtml.arg(sharedUrl.getFullUrl(), sharedUrl.getHost()));
|
allRowsHtml += rowHtml.arg(canConnect ? imgOk : imgFailed, urlLinkHtml.arg(sharedUrl.getFullUrl(), sharedUrl.getHost()));
|
||||||
|
if (!sGui || sGui->isShuttingDown()) { return; } // shutdown during connect test
|
||||||
}
|
}
|
||||||
ui->lbl_SharedUrls->setText(tableHtml.arg(allRowsHtml.trimmed()));
|
ui->lbl_SharedUrls->setText(tableHtml.arg(allRowsHtml.trimmed()));
|
||||||
ui->lbl_SharedUrls->setToolTip(sGui->getWebDataServices()->getDbReaderCurrentSharedDbDataUrl().toQString());
|
ui->lbl_SharedUrls->setToolTip(sGui->getWebDataServices()->getDbReaderCurrentSharedDbDataUrl().toQString());
|
||||||
|
|||||||
Reference in New Issue
Block a user