refs #921, avoid issue when called during shutdown

This commit is contained in:
Klaus Basan
2017-03-29 02:47:51 +02:00
committed by Mathew Sutcliffe
parent d4fbf8b49c
commit 9eb67edddf
2 changed files with 17 additions and 7 deletions

View File

@@ -28,7 +28,6 @@ namespace BlackGui
ui(new Ui::CDbLoadOverviewComponent)
{
Q_ASSERT_X(sGui, Q_FUNC_INFO, "missing sGui");
Q_ASSERT_X(sGui->getWebDataServices(), Q_FUNC_INFO, "no data services");
ui->setupUi(this);
this->admitCaches(); // in background
@@ -59,8 +58,11 @@ namespace BlackGui
connect(ui->pb_LoadAllFromDB, &QPushButton::pressed, this, &CDbLoadOverviewComponent::loadAllFromDb);
connect(ui->pb_LoadAllFromShared, &QPushButton::pressed, this, &CDbLoadOverviewComponent::loadAllFromShared);
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbLoadOverviewComponent::ps_dataLoaded);
connect(this, &CDbLoadOverviewComponent::ps_triggerDigestGuiUpdate, this, &CDbLoadOverviewComponent::ps_setValues);
if (sGui->hasWebDataServices())
{
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbLoadOverviewComponent::ps_dataLoaded);
}
}
CDbLoadOverviewComponent::~CDbLoadOverviewComponent()
@@ -241,6 +243,7 @@ namespace BlackGui
void CDbLoadOverviewComponent::admitCaches()
{
if (!sGui->hasWebDataServices()) { return; }
sGui->getWebDataServices()->admitDbCaches(CEntityFlags::AllDbEntities);
}

View File

@@ -30,15 +30,21 @@ namespace BlackGui
void CInfoBarWebReadersStatusBase::init()
{
Q_ASSERT_X(sGui, Q_FUNC_INFO, "No sGui");
Q_ASSERT_X(sGui->hasWebDataServices(), Q_FUNC_INFO, "No web data services");
this->initLeds();
bool c = connect(&m_timer, &QTimer::timeout, this, &CInfoBarWebReadersStatusBase::ps_checkServerAndData);
Q_ASSERT_X(c, Q_FUNC_INFO, "Failed connect");
// connect timer
m_timer.setInterval(30 * 1000);
m_timer.start();
m_timer.setObjectName("CInfoBarWebReadersStatusBase::CheckSwiftDbTimer");
c = connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CInfoBarWebReadersStatusBase::ps_dataRead);
bool c = connect(&m_timer, &QTimer::timeout, this, &CInfoBarWebReadersStatusBase::ps_checkServerAndData);
Q_ASSERT_X(c, Q_FUNC_INFO, "Failed connect");
if (sGui->hasWebDataServices())
{
c = connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CInfoBarWebReadersStatusBase::ps_dataRead);
Q_ASSERT_X(c, Q_FUNC_INFO, "Failed connect");
}
Q_UNUSED(c);
}
@@ -70,8 +76,9 @@ namespace BlackGui
void CInfoBarWebReadersStatusBase::ps_checkServerAndData()
{
bool swift =
const bool swift =
sGui &&
sGui->hasWebDataServices() &&
sGui->getWebDataServices()->canConnectSwiftDb();
this->led_SwiftDb->setOn(swift);