summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2014-09-04 10:23:05 -0500
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2014-09-05 10:32:09 +0300
commit362656bfa308b653ed6c40b3e788b481d92b7cc8 (patch)
treed26739bed5f73ec43373623f06395ec351a3ea69
parentbfb4ade1a0f2faa4dd38c542ff72909eaa1c7be3 (diff)
downloadweston-362656bfa308b653ed6c40b3e788b481d92b7cc8.tar.gz
weston-362656bfa308b653ed6c40b3e788b481d92b7cc8.tar.bz2
weston-362656bfa308b653ed6c40b3e788b481d92b7cc8.zip
touch-input: Don't dereference NULL pointer during full screen fade
If a full screen program is fading out and a touch start happens, it will result in a NULL pointer dereference when weston_touch_set_focus tries to derefernce view->surface->resource. Instead, this patch sets the focus to NULL, which should be the same as if the program was destroyed during the touch anyway. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=78706 Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-rw-r--r--desktop-shell/shell.c6
-rw-r--r--src/input.c10
2 files changed, 13 insertions, 3 deletions
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index bf52b93c..ad6750d3 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -4444,10 +4444,14 @@ fullscreen_binding(struct weston_seat *seat, uint32_t time, uint32_t button, voi
static void
touch_move_binding(struct weston_seat *seat, uint32_t time, void *data)
{
- struct weston_surface *focus = seat->touch->focus->surface;
+ struct weston_surface *focus;
struct weston_surface *surface;
struct shell_surface *shsurf;
+ if (seat->touch->focus == NULL)
+ return;
+
+ focus = seat->touch->focus->surface;
surface = weston_surface_get_main_surface(focus);
if (surface == NULL)
return;
diff --git a/src/input.c b/src/input.c
index d03333a6..5e82f5dd 100644
--- a/src/input.c
+++ b/src/input.c
@@ -1471,8 +1471,14 @@ weston_touch_set_focus(struct weston_seat *seat, struct weston_view *view)
}
if (view) {
- struct wl_client *surface_client =
- wl_resource_get_client(view->surface->resource);
+ struct wl_client *surface_client;
+
+ if (!view->surface->resource) {
+ seat->touch->focus = NULL;
+ return;
+ }
+
+ surface_client = wl_resource_get_client(view->surface->resource);
move_resources_for_client(focus_resource_list,
&seat->touch->resource_list,
surface_client);