diff --git a/src/common/guifacade.cpp b/src/common/guifacade.cpp index c43c11002..6b359eed6 100644 --- a/src/common/guifacade.cpp +++ b/src/common/guifacade.cpp @@ -30,7 +30,6 @@ #include "common/instancehandle.hpp" #include -#include #include @@ -38,11 +37,8 @@ namespace gui { using std::string; using std::unique_ptr; - using std::bind; - using std::placeholders::_1; using lumiera::Subsys; using lumiera::InstanceHandle; - using util::dispatchSequenced; using lib::Sync; using lib::RecursiveLock_NoWait; @@ -103,15 +99,20 @@ namespace gui { } bool - start (lumiera::Option&, Subsys::SigTerm termination) override + start (lumiera::Option&, Subsys::SigTerm termNotification) override { Lock guard (this); - if (facade) return false; // already started + if (facade) + return false; // already started + + facade.reset ( // trigger loading of the GuiStarterPlugin... + new GuiRunner ( + [=] (string* problemMessage) + { // will be invoked when the UI thread exits + closeGuiModule(); + termNotification(problemMessage); + })); - facade.reset ( - new GuiRunner ( // trigger loading load the GuiStarterPlugin... - dispatchSequenced( closeOnTermination_ // on termination call this->closeGuiModule(*) first - , termination))); //...followed by invoking the given termSignal return true; } @@ -140,7 +141,7 @@ namespace gui { void - closeGuiModule (std::string *) + closeGuiModule () { Lock guard (this); if (!facade) @@ -153,14 +154,11 @@ namespace gui { } - Subsys::SigTerm closeOnTermination_; public: - GuiSubsysDescriptor() - : closeOnTermination_ (bind (&GuiSubsysDescriptor::closeGuiModule, this, _1)) - { } + GuiSubsysDescriptor() { } - ~GuiSubsysDescriptor() + ~GuiSubsysDescriptor() { if (facade) { diff --git a/src/gui/guistart.cpp b/src/gui/guistart.cpp index 5f7ca08fc..39b088695 100644 --- a/src/gui/guistart.cpp +++ b/src/gui/guistart.cpp @@ -65,14 +65,12 @@ extern "C" { #include "common/interface-descriptor.h" } -#include #include using std::string; using backend::Thread; -using std::bind; using lumiera::Subsys; using lumiera::error::LUMIERA_ERROR_STATE; using gui::LUMIERA_INTERFACE_INAME(lumieraorg_Gui, 1); @@ -149,7 +147,7 @@ namespace gui { { try { - Thread ("GUI-Main", bind (&runGUI, terminationHandle)); + Thread {"GUI-Main", [&]() { runGUI(terminationHandle); }}; return true; // if we reach this line... } catch(...)