@@ -151,6 +151,7 @@ void ProxyWindowBase::completeWindow() {
151
151
this ->window ->setScreen (this ->mScreen );
152
152
} else if (this ->mScreen == nullptr ) {
153
153
this ->mScreen = this ->window ->screen ();
154
+ QObject::connect (this ->mScreen , &QObject::destroyed, this , &ProxyWindowBase::onScreenDestroyed);
154
155
}
155
156
156
157
this ->setWidth (this ->mWidth );
@@ -267,15 +268,11 @@ void ProxyWindowBase::setHeight(qint32 height) {
267
268
}
268
269
269
270
void ProxyWindowBase::setScreen (QuickshellScreenInfo* screen) {
270
- if (this ->mScreen != nullptr ) {
271
- QObject::disconnect (this ->mScreen , nullptr , this , nullptr );
272
- }
273
-
274
271
auto * qscreen = screen == nullptr ? nullptr : screen->screen ;
275
272
if (qscreen == this ->mScreen ) return ;
276
273
277
- if (qscreen != nullptr ) {
278
- QObject::connect (qscreen, &QObject::destroyed , this , &ProxyWindowBase::onScreenDestroyed );
274
+ if (this -> mScreen != nullptr ) {
275
+ QObject::disconnect ( this -> mScreen , nullptr , this , nullptr );
279
276
}
280
277
281
278
if (this ->window == nullptr ) {
@@ -289,6 +286,8 @@ void ProxyWindowBase::setScreen(QuickshellScreenInfo* screen) {
289
286
290
287
if (qscreen) this ->mScreen = qscreen;
291
288
else this ->mScreen = this ->window ->screen ();
289
+
290
+ QObject::connect (this ->mScreen , &QObject::destroyed, this , &ProxyWindowBase::onScreenDestroyed);
292
291
}
293
292
294
293
void ProxyWindowBase::onScreenDestroyed () { this ->mScreen = nullptr ; }
0 commit comments