summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Wu <zhiwen.wu@linux.intel.com>2012-03-05 14:13:13 +0800
committerKristian Høgsberg <krh@bitplanet.net>2012-03-08 13:08:00 -0500
commit9c35e6b47d51c0a36581a4bb4023ccd85e61b834 (patch)
treeddfa64213b2ea22ba8fdd071a9da5b71b2d5ac38
parentaa08e2d56dcf3d1e8091cb0f452f599fbe57b84a (diff)
shell: Fix segment fault when clicking to activate a NULL pointer_focus
This can happen for instance running a toytoolkit application, launching the popup menu and then clicking on a surface that does not belong to the client that create the popup surface.
-rw-r--r--src/shell.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/shell.c b/src/shell.c
index 31989b9..f942cf9 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1384,6 +1384,9 @@ click_to_activate_binding(struct wl_input_device *device,
struct weston_surface *upper;
focus = (struct weston_surface *) device->pointer_focus;
+ if (!focus)
+ return;
+
upper = container_of(focus->link.prev, struct weston_surface, link);
if (focus->link.prev != &compositor->surface_list &&
get_shell_surface_type(upper) == SHELL_SURFACE_FULLSCREEN) {
@@ -1392,7 +1395,7 @@ click_to_activate_binding(struct wl_input_device *device,
focus = upper;
}
- if (state && focus && device->pointer_grab == &device->default_pointer_grab)
+ if (state && device->pointer_grab == &device->default_pointer_grab)
activate(compositor->shell, focus, wd, time);
}