[Mesa-dev] [PATCH 4/7] radeonsi: fix a crash in si_destroy_context if we fail early

Marek Olšák maraeo at gmail.com
Thu May 25 17:04:44 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/drivers/radeonsi/si_pipe.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index 909a959..de4e5da 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -38,21 +38,22 @@
  */
 static void si_destroy_context(struct pipe_context *context)
 {
 	struct si_context *sctx = (struct si_context *)context;
 	int i;
 
 	/* Unreference the framebuffer normally to disable related logic
 	 * properly.
 	 */
 	struct pipe_framebuffer_state fb = {};
-	context->set_framebuffer_state(context, &fb);
+	if (context->set_framebuffer_state)
+		context->set_framebuffer_state(context, &fb);
 
 	si_release_all_descriptors(sctx);
 
 	if (sctx->ce_suballocator)
 		u_suballocator_destroy(sctx->ce_suballocator);
 
 	r600_resource_reference(&sctx->ce_ram_saved_buffer, NULL);
 	pipe_resource_reference(&sctx->esgs_ring, NULL);
 	pipe_resource_reference(&sctx->gsvs_ring, NULL);
 	pipe_resource_reference(&sctx->tf_ring, NULL);
-- 
2.7.4



More information about the mesa-dev mailing list