From 08f4ee30b2c5bfd9a7354d3e06b1426faa059b89 Mon Sep 17 00:00:00 2001 From: Nav Date: Wed, 9 Feb 2022 17:50:32 +0000 Subject: [PATCH] Shutdown Bloom, if configured to do so, upon receiving the DebugSessionFinished event --- src/Application.cpp | 10 ++++++++++ src/Application.hpp | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/src/Application.cpp b/src/Application.cpp index d38e46ad..339c8ce0 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -114,6 +114,10 @@ namespace Bloom std::bind(&Application::onDebugServerThreadStateChanged, this, std::placeholders::_1) ); + applicationEventListener->registerCallbackForEventType( + std::bind(&Application::onDebugSessionFinished, this, std::placeholders::_1) + ); + this->startTargetController(); this->startDebugServer(); @@ -449,4 +453,10 @@ namespace Bloom this->shutdown(); } } + + void Application::onDebugSessionFinished(const Events::DebugSessionFinished& event) { + if (this->environmentConfig->shutdownPostDebugSession) { + this->shutdown(); + } + } } diff --git a/src/Application.hpp b/src/Application.hpp index 75223da1..785c9ec2 100644 --- a/src/Application.hpp +++ b/src/Application.hpp @@ -301,5 +301,12 @@ namespace Bloom * @param event */ void onDebugServerThreadStateChanged(const Events::DebugServerThreadStateChanged& event); + + /** + * If configured to do so, Bloom will shutdown upon the end of the current debug session. + * + * @param event + */ + void onDebugSessionFinished(const Events::DebugSessionFinished& event); }; }