Skip to content

Commit 3edb3f4

Browse files
committed
core/reloader: disconnect old generation before reloading
Previously the old generation was not disconnected, causing the root wrapper's generation pointer to be nulled when pointing to the new generation, leaving multiple shell versions running simultaneously.
1 parent 60349f1 commit 3edb3f4

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/core/rootwrapper.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
#include "shell.hpp"
1818

1919
RootWrapper::RootWrapper(QString rootPath, QString shellId)
20-
: QObject(nullptr)
21-
, rootPath(std::move(rootPath))
22-
, shellId(std::move(shellId))
23-
, originalWorkingDirectory(QDir::current().absolutePath()) {
20+
: QObject(nullptr)
21+
, rootPath(std::move(rootPath))
22+
, shellId(std::move(shellId))
23+
, originalWorkingDirectory(QDir::current().absolutePath()) {
2424
// clang-format off
2525
QObject::connect(QuickshellSettings::instance(), &QuickshellSettings::watchFilesChanged, this, &RootWrapper::onWatchFilesChanged);
2626
// clang-format on
@@ -92,11 +92,14 @@ void RootWrapper::reloadGraph(bool hard) {
9292

9393
component.completeCreate();
9494

95+
if (this->generation) {
96+
QObject::disconnect(this->generation, nullptr, this, nullptr);
97+
}
98+
9599
auto isReload = this->generation != nullptr;
96100
generation->onReload(hard ? nullptr : this->generation);
97101

98-
if (hard && this->generation != nullptr) {
99-
QObject::disconnect(this->generation, nullptr, this, nullptr);
102+
if (hard && this->generation) {
100103
this->generation->destroy();
101104
}
102105

0 commit comments

Comments
 (0)