diff --git a/src/core/rootwrapper.cpp b/src/core/rootwrapper.cpp index c4c5e711..ec0d0a89 100644 --- a/src/core/rootwrapper.cpp +++ b/src/core/rootwrapper.cpp @@ -96,6 +96,7 @@ void RootWrapper::reloadGraph(bool hard) { generation->onReload(hard ? nullptr : this->generation); if (hard && this->generation != nullptr) { + QObject::disconnect(this->generation, nullptr, this, nullptr); this->generation->destroy(); } @@ -103,6 +104,7 @@ void RootWrapper::reloadGraph(bool hard) { qInfo() << "Configuration Loaded"; + QObject::connect(this->generation, &QObject::destroyed, this, &RootWrapper::generationDestroyed); QObject::connect( this->generation, &EngineGeneration::filesChanged, @@ -117,6 +119,8 @@ void RootWrapper::reloadGraph(bool hard) { } } +void RootWrapper::generationDestroyed() { this->generation = nullptr; } + void RootWrapper::onWatchFilesChanged() { auto watchFiles = QuickshellSettings::instance()->watchFiles(); if (this->generation != nullptr) { diff --git a/src/core/rootwrapper.hpp b/src/core/rootwrapper.hpp index 46603097..02d7a143 100644 --- a/src/core/rootwrapper.hpp +++ b/src/core/rootwrapper.hpp @@ -19,6 +19,7 @@ public: void reloadGraph(bool hard); private slots: + void generationDestroyed(); void onWatchFilesChanged(); void onWatchedFilesChanged();