Skip to content

Commit

Permalink
Fix multiple instances with unique scripts resetting to previous comm…
Browse files Browse the repository at this point in the history
…on script on file save

Fixes #239
  • Loading branch information
Cuperino committed Sep 28, 2024
1 parent 57d2cfc commit d58fc8c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/documenthandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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";
Expand Down

0 comments on commit d58fc8c

Please sign in to comment.