diff --git a/src/core/generation.cpp b/src/core/generation.cpp index e43db6e..aef1204 100644 --- a/src/core/generation.cpp +++ b/src/core/generation.cpp @@ -84,6 +84,14 @@ void EngineGeneration::destroy() { } } +void EngineGeneration::shutdown() { + delete this->root; + this->root = nullptr; + delete this->engine; + this->engine = nullptr; + delete this; +} + void EngineGeneration::onReload(EngineGeneration* old) { if (old != nullptr) { // if the old generation holds the window incubation controller as the diff --git a/src/core/generation.hpp b/src/core/generation.hpp index f757113..760c19c 100644 --- a/src/core/generation.hpp +++ b/src/core/generation.hpp @@ -51,6 +51,7 @@ public: QuickshellGlobal* qsgInstance = nullptr; void destroy(); + void shutdown(); signals: void filesChanged(); diff --git a/src/core/rootwrapper.cpp b/src/core/rootwrapper.cpp index 1afb30c..096ac4d 100644 --- a/src/core/rootwrapper.cpp +++ b/src/core/rootwrapper.cpp @@ -35,11 +35,8 @@ RootWrapper::RootWrapper(QString rootPath) RootWrapper::~RootWrapper() { // event loop may no longer be running so deleteLater is not an option if (this->generation != nullptr) { - delete this->generation->root; - this->generation->root = nullptr; + this->generation->shutdown(); } - - delete this->generation; } void RootWrapper::reloadGraph(bool hard) {