Fix crash in wayland when closing a window

The focus_pointer only pointer was only cleared when the window existed,
which caused a dangling focus_pointer when closing a window.
This commit is contained in:
Campbell Barton 2022-06-18 16:48:58 +10:00
parent 35b2b9b6e6
commit 881d1c9bc2
1 changed files with 3 additions and 2 deletions

View File

@ -1161,12 +1161,13 @@ static void pointer_handle_leave(void *data,
uint32_t /*serial*/,
struct wl_surface *surface)
{
/* First clear the `focus_pointer`, since the window won't exist when closing the window. */
static_cast<input_t *>(data)->focus_pointer = nullptr;
GHOST_IWindow *win = window_from_surface(surface);
if (!win) {
return;
}
static_cast<input_t *>(data)->focus_pointer = nullptr;
static_cast<GHOST_WindowWayland *>(win)->deactivate();
}