mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +08:00
Make sure contexts are "gracefulShutdown"
The shutdown was NOT called as it was canceled because of being in shutdown mode
This commit is contained in:
committed by
Mat Sutcliffe
parent
53bd5e6be7
commit
cb78453e7c
@@ -250,7 +250,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
bool CApplication::isShuttingDown() const
|
bool CApplication::isShuttingDown() const
|
||||||
{
|
{
|
||||||
return m_shutdown;
|
return m_shutdown || m_shutdownInProgress;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CApplication::isIncognito() const
|
bool CApplication::isIncognito() const
|
||||||
@@ -1069,7 +1069,6 @@ namespace BlackCore
|
|||||||
|
|
||||||
// mark as shutdown
|
// mark as shutdown
|
||||||
if (m_networkWatchDog) { m_networkWatchDog->gracefulShutdown(); }
|
if (m_networkWatchDog) { m_networkWatchDog->gracefulShutdown(); }
|
||||||
m_shutdown = true;
|
|
||||||
|
|
||||||
// save settings (but only when application was really alive)
|
// save settings (but only when application was really alive)
|
||||||
if (m_parsed && m_saveSettingsOnShutdown)
|
if (m_parsed && m_saveSettingsOnShutdown)
|
||||||
@@ -1083,7 +1082,7 @@ namespace BlackCore
|
|||||||
// from here on we really rip apart the application object
|
// from here on we really rip apart the application object
|
||||||
// and it should no longer be used
|
// and it should no longer be used
|
||||||
|
|
||||||
if (this->supportsContexts())
|
if (this->supportsContexts(true))
|
||||||
{
|
{
|
||||||
CLogMessage(this).info(u"Graceful shutdown of CApplication, shutdown of contexts");
|
CLogMessage(this).info(u"Graceful shutdown of CApplication, shutdown of contexts");
|
||||||
|
|
||||||
@@ -1117,8 +1116,12 @@ namespace BlackCore
|
|||||||
|
|
||||||
// clean up all in "deferred delete state"
|
// clean up all in "deferred delete state"
|
||||||
qApp->sendPostedEvents(nullptr, QEvent::DeferredDelete);
|
qApp->sendPostedEvents(nullptr, QEvent::DeferredDelete);
|
||||||
|
sApp->processEventsFor(500);
|
||||||
|
|
||||||
|
// completed
|
||||||
|
m_shutdown = true;
|
||||||
sApp = nullptr;
|
sApp = nullptr;
|
||||||
|
|
||||||
disconnect(this);
|
disconnect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1548,9 +1551,9 @@ namespace BlackCore
|
|||||||
// Contexts
|
// Contexts
|
||||||
// ---------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------
|
||||||
|
|
||||||
bool CApplication::supportsContexts() const
|
bool CApplication::supportsContexts(bool ignoreShutdownTest) const
|
||||||
{
|
{
|
||||||
if (m_shutdown) { return false; }
|
if (!ignoreShutdownTest && m_shutdown) { return false; }
|
||||||
if (m_coreFacade.isNull()) { return false; }
|
if (m_coreFacade.isNull()) { return false; }
|
||||||
if (!m_coreFacade->getIContextApplication()) { return false; }
|
if (!m_coreFacade->getIContextApplication()) { return false; }
|
||||||
return (!m_coreFacade->getIContextApplication()->isEmptyObject());
|
return (!m_coreFacade->getIContextApplication()->isEmptyObject());
|
||||||
|
|||||||
@@ -346,7 +346,7 @@ namespace BlackCore
|
|||||||
//! Supports contexts
|
//! Supports contexts
|
||||||
//! \remark checks the real availability of the contexts, so it can happen that we want to use contexts, and they are not yet initialized (false here)
|
//! \remark checks the real availability of the contexts, so it can happen that we want to use contexts, and they are not yet initialized (false here)
|
||||||
//! \sa m_useContexts we use or we will use contexts
|
//! \sa m_useContexts we use or we will use contexts
|
||||||
bool supportsContexts() const;
|
bool supportsContexts(bool ignoreShutdownTest = false) const;
|
||||||
|
|
||||||
//! The core facade config
|
//! The core facade config
|
||||||
const CCoreFacadeConfig &getCoreFacadeConfig() const { return m_coreFacadeConfig; }
|
const CCoreFacadeConfig &getCoreFacadeConfig() const { return m_coreFacadeConfig; }
|
||||||
|
|||||||
Reference in New Issue
Block a user