forked from quickshell/quickshell
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.
This commit is contained in:
parent
60349f1894
commit
3edb3f4efa
1 changed files with 9 additions and 6 deletions
|
@ -17,10 +17,10 @@
|
|||
#include "shell.hpp"
|
||||
|
||||
RootWrapper::RootWrapper(QString rootPath, QString shellId)
|
||||
: QObject(nullptr)
|
||||
, rootPath(std::move(rootPath))
|
||||
, shellId(std::move(shellId))
|
||||
, originalWorkingDirectory(QDir::current().absolutePath()) {
|
||||
: QObject(nullptr)
|
||||
, rootPath(std::move(rootPath))
|
||||
, shellId(std::move(shellId))
|
||||
, originalWorkingDirectory(QDir::current().absolutePath()) {
|
||||
// clang-format off
|
||||
QObject::connect(QuickshellSettings::instance(), &QuickshellSettings::watchFilesChanged, this, &RootWrapper::onWatchFilesChanged);
|
||||
// clang-format on
|
||||
|
@ -92,11 +92,14 @@ void RootWrapper::reloadGraph(bool hard) {
|
|||
|
||||
component.completeCreate();
|
||||
|
||||
if (this->generation) {
|
||||
QObject::disconnect(this->generation, nullptr, this, nullptr);
|
||||
}
|
||||
|
||||
auto isReload = this->generation != nullptr;
|
||||
generation->onReload(hard ? nullptr : this->generation);
|
||||
|
||||
if (hard && this->generation != nullptr) {
|
||||
QObject::disconnect(this->generation, nullptr, this, nullptr);
|
||||
if (hard && this->generation) {
|
||||
this->generation->destroy();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue