From fede3fc4c733f9f12da9fdb847beefdfab94c1e9 Mon Sep 17 00:00:00 2001 From: Mathew Sutcliffe Date: Thu, 19 Jun 2014 22:10:50 +0100 Subject: [PATCH] refs #270 don't call CRuntime::gracefulShutdown from a different thread; connect it to the QCoreApplication::aboutToQuit signal instead --- samples/blackcore/tool.cpp | 1 - src/blackcore/context_runtime.cpp | 2 ++ src/blackcore/context_runtime.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/samples/blackcore/tool.cpp b/samples/blackcore/tool.cpp index 3bbe7e15e..6832a192a 100644 --- a/samples/blackcore/tool.cpp +++ b/samples/blackcore/tool.cpp @@ -154,7 +154,6 @@ namespace BlackMiscTest else if (line.startsWith("all")) runtime->slotLog(enable); } } - runtime->gracefulShutdown(); QCoreApplication::quit(); } } // namespace diff --git a/src/blackcore/context_runtime.cpp b/src/blackcore/context_runtime.cpp index 66f682861..d70101925 100644 --- a/src/blackcore/context_runtime.cpp +++ b/src/blackcore/context_runtime.cpp @@ -305,6 +305,8 @@ namespace BlackCore BlackSim::registerMetadata(); BlackCore::registerMetadata(); + this->connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, this, &CRuntime::gracefulShutdown); + // upfront reading of settings, as DBus server already relies on settings CContextSettings *settings = nullptr; QString dbusAddress; diff --git a/src/blackcore/context_runtime.h b/src/blackcore/context_runtime.h index 104f42961..426f800a4 100644 --- a/src/blackcore/context_runtime.h +++ b/src/blackcore/context_runtime.h @@ -139,7 +139,7 @@ namespace BlackCore //! Slot logging for bool value from a specific context void logSlot(LogContext ctx, const char *func, bool boolValue) const; - //! shutdown + //! Clean up (will be connected to signal QCoreApplication::aboutToQuit) void gracefulShutdown(); // ------- Context as interface, normal way to access a context