Skip to content

Commit 0522f1c

Browse files
Dami-starzccrs
authored andcommitted
fix: Crash when unplugging screen
1 parent 7cc928a commit 0522f1c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/server/kernel/wsurface.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,8 @@ void WSurface::enterOutput(WOutput *output)
316316
return;
317317
wlr_surface_send_enter(d->nativeHandle(), output->handle()->handle());
318318

319-
connect(output, &WOutput::destroyed, this, [d] {
320-
d->updateOutputs();
319+
connect(output, &WOutput::aboutToBeInvalidated, this, [this, output] {
320+
leaveOutput(output);
321321
});
322322
output->safeConnect(&WOutput::scaleChanged, this, [d] {
323323
d->updatePreferredBufferScale();
@@ -360,7 +360,7 @@ void WSurface::leaveOutput(WOutput *output)
360360
d->ensureSubsurface(subsurface)->leaveOutput(output);
361361
}
362362

363-
Q_EMIT outputLeft(output);
363+
Q_EMIT outputLeave(output);
364364
}
365365

366366
const QVector<WOutput *> &WSurface::outputs() const

src/server/kernel/wsurface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public Q_SLOTS:
8080
void newSubsurface(WSurface *subsurface);
8181
void preferredBufferScaleChanged();
8282
void outputEntered(WOutput *output);
83-
void outputLeft(WOutput *output);
83+
void outputLeave(WOutput *output);
8484

8585
protected:
8686
WSurface(WSurfacePrivate &dd, QObject *parent);

src/server/protocols/wforeigntoplevelv1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class Q_DECL_HIDDEN WForeignToplevelPrivate : public WObjectPrivate {
9999
handle->output_enter(output->nativeHandle());
100100
}));
101101

102-
connection.push_back(surface->surface()->safeConnect(&WSurface::outputLeft, surface, [this, handle](WOutput *output) {
102+
connection.push_back(surface->surface()->safeConnect(&WSurface::outputLeave, surface, [this, handle](WOutput *output) {
103103
handle->output_leave(output->nativeHandle());
104104
}));
105105

0 commit comments

Comments
 (0)