fix: root is now destroyed on exit

This should fix a whole lot of things never being able to run cleanup.
This commit is contained in:
outfoxxed 2024-03-03 06:26:41 -08:00
parent b5110b759e
commit bccf43f1f7
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
2 changed files with 8 additions and 0 deletions

View file

@ -26,6 +26,11 @@ RootWrapper::RootWrapper(QString rootPath)
} }
} }
RootWrapper::~RootWrapper() {
// event loop may no longer be running so deleteLater is not an option
delete this->root;
}
void RootWrapper::reloadGraph(bool hard) { void RootWrapper::reloadGraph(bool hard) {
if (this->root != nullptr) { if (this->root != nullptr) {
this->engine.clearComponentCache(); this->engine.clearComponentCache();

View file

@ -2,6 +2,7 @@
#include <qobject.h> #include <qobject.h>
#include <qqmlengine.h> #include <qqmlengine.h>
#include <qtclasshelpermacros.h>
#include <qtmetamacros.h> #include <qtmetamacros.h>
#include <qurl.h> #include <qurl.h>
@ -13,6 +14,8 @@ class RootWrapper: public QObject {
public: public:
explicit RootWrapper(QString rootPath); explicit RootWrapper(QString rootPath);
~RootWrapper() override;
Q_DISABLE_COPY_MOVE(RootWrapper);
void reloadGraph(bool hard); void reloadGraph(bool hard);