From e25f871d87a8015344a6cbc0859e4f8fc07998df Mon Sep 17 00:00:00 2001 From: "Pierre-Loup A. Griffais" Date: Wed, 5 May 2021 16:37:51 -0700 Subject: [PATCH] wlserver: avoid accessing mouse_focus_surface after destruction We should also set the focus to something else that makes sense, which means there's another bug in a higher-level layer somewhere, but at least don't crash. --- src/wlserver.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wlserver.cpp b/src/wlserver.cpp index 0c0453e..7da377e 100644 --- a/src/wlserver.cpp +++ b/src/wlserver.cpp @@ -801,6 +801,11 @@ void wlserver_surface_set_wl_id( struct wlserver_surface *surf, long id ) void wlserver_surface_finish( struct wlserver_surface *surf ) { + if ( surf->wlr == wlserver.mouse_focus_surface ) + { + wlserver.mouse_focus_surface = nullptr; + } + surf->wl_id = 0; surf->wlr = nullptr; wl_list_remove( &surf->pending_link );