[PATCH] input: Fix a segfault in focus checking
Jason Ekstrand
jason at jlekstrand.net
Thu Nov 14 18:06:16 PST 2013
Without this, weston will segfault whenever the focus is a non-client
surface such as the black surface in fullscreen.
---
src/input.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/input.c b/src/input.c
index 6637882..b6130d6 100644
--- a/src/input.c
+++ b/src/input.c
@@ -332,7 +332,8 @@ default_grab_keyboard_modifiers(struct weston_keyboard_grab *grab,
wl_keyboard_send_modifiers(resource, serial, mods_depressed,
mods_latched, mods_locked, group);
}
- if (pointer && pointer->focus && pointer->focus->surface != keyboard->focus) {
+ if (pointer && pointer->focus && pointer->focus->surface->resource &&
+ pointer->focus->surface != keyboard->focus) {
struct wl_client *pointer_client =
wl_resource_get_client(pointer->focus->surface->resource);
send_modifiers_to_client_in_list(pointer_client,
@@ -1440,11 +1441,13 @@ should_send_modifiers_to_client(struct weston_seat *seat,
{
if (seat->keyboard &&
seat->keyboard->focus &&
+ seat->keyboard->focus->resource &&
wl_resource_get_client(seat->keyboard->focus->resource) == client)
return 1;
if (seat->pointer &&
seat->pointer->focus &&
+ seat->pointer->focus->surface->resource &&
wl_resource_get_client(seat->pointer->focus->surface->resource) == client)
return 1;
--
1.8.3.1
More information about the wayland-devel
mailing list