[PATCH weston 2/4] rpi: fix segfault at startup in `rpi_flippipe_init()` due to NULL `compositor`

John Sadler deathofathousandpapercuts at gmail.com
Sat Sep 5 07:01:38 PDT 2015


When running with the RPi backend, Weston now segfaults at startup on the
line:

    flippipe->clk_id = output->base.compositor->presentation_clock;

in `rpi_flippipe_init()`.

This is because `output->base.compositor` is NULL. This problem did not
exist on 1.8.0, and it looks like it may have been introduced by 954f183e2f.

This commit ensures that the `compositor` is initialised in `rpi_backend`
and the output base, prior to the above function being called.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91885

Signed-off-by: John Sadler <deathofathousandpapercuts at gmail.com>
---
 src/compositor-rpi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/compositor-rpi.c b/src/compositor-rpi.c
index 602cbee..340a974 100644
--- a/src/compositor-rpi.c
+++ b/src/compositor-rpi.c
@@ -305,6 +305,7 @@ rpi_output_create(struct rpi_backend *backend, uint32_t transform)
 
 	output->backend = backend;
 	output->single_buffer = backend->single_buffer;
+	output->base.compositor = backend->compositor;
 
 	if (rpi_flippipe_init(&output->flippipe, output) < 0) {
 		weston_log("Creating message pipe failed.\n");
@@ -495,6 +496,7 @@ rpi_backend_create(struct weston_compositor *compositor,
 		goto out_udev;
 	}
 
+	backend->compositor = compositor;
 	backend->base.destroy = rpi_backend_destroy;
 	backend->base.restore = rpi_restore;
 
-- 
1.8.1.4



More information about the wayland-devel mailing list