diff --git a/include/Application.h b/include/Application.h index 3dc31b8fd56218cd91169f0539126180695623b2..e324c0ac44a3ef8426f2d6d7eacbafd91bfa3f86 100644 --- a/include/Application.h +++ b/include/Application.h @@ -49,6 +49,8 @@ namespace ChimeraTK { * characters. Use only alphanumeric characters and underscores. */ explicit Application(const std::string& name); + ~Application() override; + using ApplicationBase::getName; /** This will remove the global pointer to the instance and allows creating diff --git a/src/Application.cc b/src/Application.cc index 972a80598faebcc50d5dfc209f745e5a708b681d..5637bc02b22961f6c02b4eda61f61326a07267d4 100644 --- a/src/Application.cc +++ b/src/Application.cc @@ -46,6 +46,16 @@ Application::Application(const std::string& name) : ApplicationBase(name), Modul /*********************************************************************************************************************/ +Application::~Application() { + if(lifeCycleState == LifeCycleState::initialisation && !hasBeenShutdown) { + // likely an exception has been thrown in the initialisation phase, in which case we better call shutdown to prevent + // ApplicationBase from complaining and hiding the exception + ApplicationBase::shutdown(); + } +} + +/*********************************************************************************************************************/ + void Application::enableTestableMode() { assert(not initialiseCalled); testableMode.enable();