summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>2016-03-16 14:54:12 +0200
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2016-03-24 13:48:21 +0200
commit94cb06a208130b0ee16553a2cd513e5e7d67f368 (patch)
treec550870543dafbe6f83c1a15dd3b21bcbb9a00a0
parentfd45f60f4e18454489566e1bf61cb1b27b67fd91 (diff)
ivi-shell: harden get_ivi_shell_surface()
Add more sanity checks to get_ivi_shell_surface() just in case. If the configure hook is set, we must always have non-NULL configure_private. Check the ivi_shell_surface matches the surface. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Eugen Friedrich <friedrix@gmail.com>
-rw-r--r--ivi-shell/ivi-shell.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/ivi-shell/ivi-shell.c b/ivi-shell/ivi-shell.c
index d136f460..c502c742 100644
--- a/ivi-shell/ivi-shell.c
+++ b/ivi-shell/ivi-shell.c
@@ -81,10 +81,16 @@ ivi_shell_surface_configure(struct weston_surface *, int32_t, int32_t);
static struct ivi_shell_surface *
get_ivi_shell_surface(struct weston_surface *surface)
{
- if (surface->configure == ivi_shell_surface_configure)
- return surface->configure_private;
+ struct ivi_shell_surface *shsurf;
+
+ if (surface->configure != ivi_shell_surface_configure)
+ return NULL;
+
+ shsurf = surface->configure_private;
+ assert(shsurf);
+ assert(shsurf->surface == surface);
- return NULL;
+ return shsurf;
}
void