refs #846, core: shutdown when failure and assert for missing facade

This commit is contained in:
Klaus Basan
2016-12-29 01:34:22 +01:00
committed by Mathew Sutcliffe
parent 235673123d
commit ec3fc93a19
2 changed files with 7 additions and 2 deletions

View File

@@ -147,6 +147,8 @@ void CSwiftCore::initLogDisplay()
void CSwiftCore::startCore(const QString &dBusAdress) void CSwiftCore::startCore(const QString &dBusAdress)
{ {
if (dBusAdress.isEmpty()) { return; } if (dBusAdress.isEmpty()) { return; }
Q_ASSERT_X(sGui, Q_FUNC_INFO, "Missing sGui");
Q_ASSERT_X(sGui->getCoreFacade(), Q_FUNC_INFO, "Missing facade");
ui->pb_StartCore->setEnabled(false); ui->pb_StartCore->setEnabled(false);
ui->pb_StopCore->setEnabled(true); ui->pb_StopCore->setEnabled(true);
@@ -163,7 +165,6 @@ void CSwiftCore::stopCore()
ui->pb_StopCore->setEnabled(false); ui->pb_StopCore->setEnabled(false);
ui->gb_DBusMode->setDisabled(false); ui->gb_DBusMode->setDisabled(false);
sGui->processEventsToRefreshGui(); sGui->processEventsToRefreshGui();
sGui->exit(); sGui->exit();
} }

View File

@@ -29,7 +29,11 @@ int main(int argc, char *argv[])
Q_UNUSED(qa); Q_UNUSED(qa);
BlackCore::CApplication a; BlackCore::CApplication a;
a.addVatlibOptions(); a.addVatlibOptions();
a.start(); if (!a.start())
{
a.gracefulShutdown();
return EXIT_FAILURE;
}
return CBlackCoreTestMain::unitMain(argc, argv); return CBlackCoreTestMain::unitMain(argc, argv);
} }