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.
This commit is contained in:
Pierre-Loup A. Griffais 2021-05-05 16:37:51 -07:00
parent a4f3a19480
commit e25f871d87

View file

@ -801,6 +801,11 @@ void wlserver_surface_set_wl_id( struct wlserver_surface *surf, long id )
void wlserver_surface_finish( struct wlserver_surface *surf ) 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->wl_id = 0;
surf->wlr = nullptr; surf->wlr = nullptr;
wl_list_remove( &surf->pending_link ); wl_list_remove( &surf->pending_link );