forked from quickshell/quickshell
core/proxywindow: connect mScreen's destroy signal in all cases
Fixes edge case crashes when unplugging and replugging monitors.
This commit is contained in:
parent
27840db7a6
commit
611cd76abc
|
@ -151,6 +151,7 @@ void ProxyWindowBase::completeWindow() {
|
||||||
this->window->setScreen(this->mScreen);
|
this->window->setScreen(this->mScreen);
|
||||||
} else if (this->mScreen == nullptr) {
|
} else if (this->mScreen == nullptr) {
|
||||||
this->mScreen = this->window->screen();
|
this->mScreen = this->window->screen();
|
||||||
|
QObject::connect(this->mScreen, &QObject::destroyed, this, &ProxyWindowBase::onScreenDestroyed);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->setWidth(this->mWidth);
|
this->setWidth(this->mWidth);
|
||||||
|
@ -267,15 +268,11 @@ void ProxyWindowBase::setHeight(qint32 height) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProxyWindowBase::setScreen(QuickshellScreenInfo* screen) {
|
void ProxyWindowBase::setScreen(QuickshellScreenInfo* screen) {
|
||||||
if (this->mScreen != nullptr) {
|
|
||||||
QObject::disconnect(this->mScreen, nullptr, this, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto* qscreen = screen == nullptr ? nullptr : screen->screen;
|
auto* qscreen = screen == nullptr ? nullptr : screen->screen;
|
||||||
if (qscreen == this->mScreen) return;
|
if (qscreen == this->mScreen) return;
|
||||||
|
|
||||||
if (qscreen != nullptr) {
|
if (this->mScreen != nullptr) {
|
||||||
QObject::connect(qscreen, &QObject::destroyed, this, &ProxyWindowBase::onScreenDestroyed);
|
QObject::disconnect(this->mScreen, nullptr, this, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->window == nullptr) {
|
if (this->window == nullptr) {
|
||||||
|
@ -289,6 +286,8 @@ void ProxyWindowBase::setScreen(QuickshellScreenInfo* screen) {
|
||||||
|
|
||||||
if (qscreen) this->mScreen = qscreen;
|
if (qscreen) this->mScreen = qscreen;
|
||||||
else this->mScreen = this->window->screen();
|
else this->mScreen = this->window->screen();
|
||||||
|
|
||||||
|
QObject::connect(this->mScreen, &QObject::destroyed, this, &ProxyWindowBase::onScreenDestroyed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProxyWindowBase::onScreenDestroyed() { this->mScreen = nullptr; }
|
void ProxyWindowBase::onScreenDestroyed() { this->mScreen = nullptr; }
|
||||||
|
|
Loading…
Reference in a new issue