[PATCH weston 7/7] pixman-renderer: Don't unreference NULL hw_buffer image

Ander Conselvan de Oliveira ander.conselvan.de.oliveira at intel.com
Fri Jan 25 05:13:06 PST 2013


If the buffer for an output was never set, or was reset to NULL at some
point, destroying the renderer output private would cause a crash.
---
 src/compositor.c      |    1 +
 src/pixman-renderer.c |    4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/compositor.c b/src/compositor.c
index cd11f6b..a2e95c9 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -3207,6 +3207,7 @@ usage(int error_code)
 		"  --connector=ID\tBring up only this connector\n"
 		"  --seat=SEAT\t\tThe seat that weston should run on\n"
 		"  --tty=TTY\t\tThe tty to use\n"
+		"  --use-pixman\t\tUse the pixman (CPU) renderer\n"
 		"  --current-mode\tPrefer current KMS mode over EDID preferred mode\n\n");
 
 	fprintf(stderr,
diff --git a/src/pixman-renderer.c b/src/pixman-renderer.c
index 77ae99e..8d95197 100644
--- a/src/pixman-renderer.c
+++ b/src/pixman-renderer.c
@@ -507,7 +507,9 @@ pixman_renderer_output_destroy(struct weston_output *output)
 	struct pixman_output_state *po = get_output_state(output);
 
 	pixman_image_unref(po->shadow_image);
-	pixman_image_unref(po->hw_buffer);
+
+	if (po->hw_buffer)
+		pixman_image_unref(po->hw_buffer);
 
 	po->shadow_image = NULL;
 	po->hw_buffer = NULL;
-- 
1.7.10.4



More information about the wayland-devel mailing list