From 960b5ebd825763c89386f265cb377092beee061a Mon Sep 17 00:00:00 2001 From: John Sadler Date: Sat, 5 Sep 2015 15:01:39 +0100 Subject: [PATCH] rpi: avoid segfault in rpir_view_compute_rects() when EGL client destroys buffer This commit works-around a serious issue when running with the RPi backend. When an EGL client shuts down and destroys it's EGL window, Weston dies with a segmentation fault in the above function (because `buffer` is now NULL). The addition of a simple NULL check avoids the problem. This is a minor re-formatting of the patch already submitted here: http://patchwork.freedesktop.org/patch/34885 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85167 Signed-off-by: John Sadler Reviewed-by: Pekka Paalanen --- src/rpi-renderer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/rpi-renderer.c b/src/rpi-renderer.c index a0960334..d0a97974 100644 --- a/src/rpi-renderer.c +++ b/src/rpi-renderer.c @@ -703,6 +703,9 @@ rpir_view_compute_rects(struct rpir_view *view, struct weston_buffer *buffer = view->surface->egl_front->buffer_ref.buffer; + if (!buffer) + return -1; + src_width = buffer->width << 16; src_height = buffer->height << 16; } else {