[PATCH weston] input: fix access to invalid resource

Giulio Camuffo giuliocamuffo at gmail.com
Fri Oct 10 13:46:50 PDT 2014


the keyboard focus surface may not have a valid resource (server side
surface or a surface surviving its client), so check if it is valid
before using it.
---
 src/input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/input.c b/src/input.c
index e765221..bc58223 100644
--- a/src/input.c
+++ b/src/input.c
@@ -1803,7 +1803,7 @@ seat_get_keyboard(struct wl_client *client, struct wl_resource *resource,
 					   seat->keyboard->focus_serial);
 	}
 
-	if (seat->keyboard->focus &&
+	if (seat->keyboard->focus && seat->keyboard->focus->resource &&
 	    wl_resource_get_client(seat->keyboard->focus->resource) == client) {
 		struct weston_surface *surface =
 			(struct weston_surface *) seat->keyboard->focus;
-- 
2.1.2



More information about the wayland-devel mailing list