From aa14c564b0561cff87d470aa23c9bed230f54762 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sat, 4 Mar 2017 19:29:55 +0100 Subject: [PATCH] Fixed SwiftGuiStd::setContextAvailability (found during testing #895) --- src/swiftguistandard/swiftguistd.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/swiftguistandard/swiftguistd.cpp b/src/swiftguistandard/swiftguistd.cpp index fbb97e621..a33d728b3 100644 --- a/src/swiftguistandard/swiftguistd.cpp +++ b/src/swiftguistandard/swiftguistd.cpp @@ -288,19 +288,22 @@ void SwiftGuiStd::ps_handleTimerBasedUpdates() void SwiftGuiStd::setContextAvailability() { - bool corePreviouslyAvailable = this->m_coreAvailable; - if (sGui && sGui->getIContextApplication()->isUsingImplementingObject()) + const bool corePreviouslyAvailable = this->m_coreAvailable; + if (sGui && + !sGui->isShuttingDown() && + sGui->getIContextApplication() && + sGui->getIContextApplication()->isUsingImplementingObject()) { - this->m_coreAvailable = true; + // ping to check if core is still alive + this->m_coreAvailable = this->isMyIdentifier(sGui->getIContextApplication()->registerApplication(getCurrentTimestampIdentifier())); } else { - // ping to check if core is still alive - this->m_coreAvailable = sGui && - this->isMyIdentifier(sGui->getIContextApplication()->registerApplication(getCurrentTimestampIdentifier())); + this->m_coreAvailable = false; } - this->m_contextNetworkAvailable = this->m_coreAvailable || (sGui && sGui->getIContextNetwork()->isUsingImplementingObject()); - this->m_contextAudioAvailable = this->m_coreAvailable || (sGui && sGui->getIContextAudio()->isUsingImplementingObject()); + + this->m_contextNetworkAvailable = this->m_coreAvailable && sGui->getIContextNetwork() && sGui->getIContextNetwork()->isUsingImplementingObject(); + this->m_contextAudioAvailable = this->m_coreAvailable && sGui->getIContextAudio() && sGui->getIContextAudio()->isUsingImplementingObject(); // react to a change in core's availability if (this->m_coreAvailable != corePreviouslyAvailable)