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 <deathofathousandpapercuts@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
dev
John Sadler 10 years ago committed by Pekka Paalanen
parent cdb91d019f
commit 960b5ebd82
  1. 3
      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 {

Loading…
Cancel
Save