diff --git a/src/common/guifacade.cpp b/src/common/guifacade.cpp index 2fb76dcc1..8b2bf0dee 100644 --- a/src/common/guifacade.cpp +++ b/src/common/guifacade.cpp @@ -136,7 +136,7 @@ namespace gui { void - closeGuiModule (lumiera::Error *) + closeGuiModule (std::string *) { Lock guard (this); if (!facade) diff --git a/src/common/subsys.hpp b/src/common/subsys.hpp index 598919bb7..ee0e229ad 100644 --- a/src/common/subsys.hpp +++ b/src/common/subsys.hpp @@ -71,7 +71,7 @@ namespace lumiera { : private noncopyable { public: - typedef function SigTerm; + typedef function SigTerm; virtual ~Subsys(); diff --git a/src/common/subsystem-runner.hpp b/src/common/subsystem-runner.hpp index f46168cd7..a25bc3dc0 100644 --- a/src/common/subsystem-runner.hpp +++ b/src/common/subsystem-runner.hpp @@ -31,6 +31,7 @@ #include #include +#include namespace lumiera { @@ -39,6 +40,7 @@ namespace lumiera { using std::tr1::function; using std::tr1::placeholders::_1; using std::vector; + using std::string; using util::cStr; using util::isnil; using util::and_all; @@ -172,12 +174,13 @@ namespace lumiera { } } void - sigTerm (Subsys* susy, Error* problem) ///< called from subsystem on termination + sigTerm (Subsys* susy, string* problem) ///< called from subsystem on termination { ASSERT (susy); Lock sync (this); - triggerEmergency(problem); + triggerEmergency(!isnil (problem)); INFO (operate, "Subsystem '%s' terminated.", cStr(*susy)); + WARN_IF (!isnil(problem), operate, "Irregular shutdown caused by: %s", cStr(*problem)); ERROR_IF (susy->isRunning(), lumiera, "Subsystem '%s' signals termination, " "without resetting running state", cStr(*susy)); removeall (running_, susy); diff --git a/src/gui/guistart.cpp b/src/gui/guistart.cpp index 43efe6004..529ea37de 100644 --- a/src/gui/guistart.cpp +++ b/src/gui/guistart.cpp @@ -89,7 +89,7 @@ namespace gui { ~GuiLifecycle () { - reportOnTermination_(0); /////////TODO: pass on error information + reportOnTermination_(&error_); // inform main thread that the GUI has been shut down. } diff --git a/src/lib/util.hpp b/src/lib/util.hpp index 402cbb435..1fba41ca1 100644 --- a/src/lib/util.hpp +++ b/src/lib/util.hpp @@ -60,6 +60,13 @@ namespace util { return !pContainer || pContainer->empty(); } + template + inline bool + isnil (CONT* pContainer) + { + return !pContainer || pContainer->empty(); + } + inline bool isnil (const char* pCStr) { diff --git a/tests/lib/subsystem-runner-test.cpp b/tests/lib/subsystem-runner-test.cpp index 2f6d65454..513b132d6 100644 --- a/tests/lib/subsystem-runner-test.cpp +++ b/tests/lib/subsystem-runner-test.cpp @@ -165,13 +165,14 @@ namespace lumiera { lumiera_error(); // reset error state.... // Note: in real life this actually // would be an catched exception! + string problemReport (problemIndicator.what()); { Lock guard (this); isUp_ = false; INFO (test, "thread %s terminates.", cStr(*this)); - termination ("true"==runSpec? 0 : &problemIndicator); + termination ("true"==runSpec? 0 : &problemReport); } }