LayerSurface: fix use-after-free on destroy

The scene_layer_surface may be destroyed before handleDestroy is called,
which means we can't rely on it to access the wlr_layer_surface in
destroyPopups().
This commit is contained in:
Isaac Freund
2023-02-28 18:19:37 +01:00
parent 005bde367c
commit e11d4dc0de
4 changed files with 12 additions and 10 deletions

View File

@ -346,7 +346,7 @@ fn updateKeyboardFocus(self: Self, result: Root.AtResult) void {
self.seat.focusOutput(layer_surface.output);
// If a keyboard inteactive layer surface has been clicked on,
// give it keyboard focus.
if (layer_surface.scene_layer_surface.layer_surface.current.keyboard_interactive != .none) {
if (layer_surface.wlr_layer_surface.current.keyboard_interactive != .none) {
self.seat.setFocusRaw(.{ .layer = layer_surface });
} else {
self.seat.focus(null);