From d58fc8cb1ae71df90f9e49d12c6bd7f7286e1a90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20O=2E=20Cordero=20P=C3=A9rez?= Date: Sat, 28 Sep 2024 13:17:56 -0400 Subject: [PATCH] Fix multiple instances with unique scripts resetting to previous common script on file save Fixes #239 --- src/documenthandler.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/documenthandler.cpp b/src/documenthandler.cpp index 9a20ca89..411239f5 100644 --- a/src/documenthandler.cpp +++ b/src/documenthandler.cpp @@ -523,8 +523,11 @@ QUrl DocumentHandler::fileUrl() const void DocumentHandler::reload(const QString &fileUrl) { - qWarning() << "reloading"; - load(QUrl(QString::fromUtf8("file://") + fileUrl)); + auto url = QUrl(QString::fromUtf8("file://") + fileUrl); + if (url == m_fileUrl) { + qWarning() << "reloading"; + load(url); + } } void DocumentHandler::loadFromNetwork(const QUrl &url) @@ -575,9 +578,6 @@ void DocumentHandler::setAutoReload(bool enable) void DocumentHandler::load(const QUrl &fileUrl) { - // if (fileUrl == m_fileUrl) - // return; - QQmlEngine *engine = qmlEngine(this); if (!engine) { qWarning() << "load() called before DocumentHandler has QQmlEngine";