Skip to content

Commit 2032248

Browse files
committed
wayland/layershell: fix bridge destructor use after free on reload
Under some conditions, Qt will recreate the layer surface. The layer surface destructor tries to destroy the bridge, but doesn't actually need to because the bridge is a child of the QWindow owning the layer, meaning not destroying it is actually completely fine.
1 parent 0499518 commit 2032248

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/wayland/wlr_layershell/surface.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,10 @@ LayerSurface::LayerSurface(LayerShellIntegration* shell, QtWaylandClient::QWayla
174174
}
175175

176176
LayerSurface::~LayerSurface() {
177-
delete this->bridge;
177+
if (this->bridge && this->bridge->surface == this) {
178+
this->bridge->surface = nullptr;
179+
}
180+
178181
this->destroy();
179182
}
180183

0 commit comments

Comments
 (0)