From af7b6c9c6d0f9a41e5d6f8f20d1c4dabc96034e6 Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Wed, 16 Jan 2013 21:26:53 +0100 Subject: [PATCH] shell: Do not crash when hiding input_panel Allow an input panel to attach a NULL-buffer for hiding. Signed-off-by: Jan Arne Petersen --- src/shell.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/shell.c b/src/shell.c index 598f286..262ce70 100644 --- a/src/shell.c +++ b/src/shell.c @@ -3260,11 +3260,17 @@ bind_screensaver(struct wl_client *client, static void input_panel_configure(struct weston_surface *surface, int32_t sx, int32_t sy) { - struct weston_mode *mode = surface->output->current; + struct weston_mode *mode; int32_t width = weston_surface_buffer_width(surface); int32_t height = weston_surface_buffer_height(surface); - float x = (mode->width - width) / 2; - float y = mode->height - height; + float x, y; + + if (!weston_surface_is_mapped(surface)) + return; + + mode = surface->output->current; + x = (mode->width - width) / 2; + y = mode->height - height; /* Don't map the input panel here, wait for * show_input_panels signal. */ -- 2.7.4