Module: Mesa
Branch: master
Commit: 6d6208a431f6a01a22f892c71258fd3567d969b6
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6d6208a431f6a01a22f892c71258fd3567d969b6

Author: Marek Olšák <marek.ol...@amd.com>
Date:   Wed May  6 19:34:09 2015 +0200

radeonsi: don't crash when cleaning up after an incomplete context

Reviewed-by: Alex Deucher <alexander.deuc...@amd.com>

---

 src/gallium/drivers/radeonsi/si_pipe.c |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_pipe.c 
b/src/gallium/drivers/radeonsi/si_pipe.c
index 4473557..7379797 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -56,18 +56,22 @@ static void si_destroy_context(struct pipe_context *context)
 
        if (sctx->pstipple_sampler_state)
                sctx->b.b.delete_sampler_state(&sctx->b.b, 
sctx->pstipple_sampler_state);
-       if (sctx->dummy_pixel_shader) {
+       if (sctx->dummy_pixel_shader)
                sctx->b.b.delete_fs_state(&sctx->b.b, sctx->dummy_pixel_shader);
-       }
        if (sctx->fixed_func_tcs_shader)
                sctx->b.b.delete_tcs_state(&sctx->b.b, 
sctx->fixed_func_tcs_shader);
-       sctx->b.b.delete_depth_stencil_alpha_state(&sctx->b.b, 
sctx->custom_dsa_flush);
-       sctx->b.b.delete_blend_state(&sctx->b.b, sctx->custom_blend_resolve);
-       sctx->b.b.delete_blend_state(&sctx->b.b, sctx->custom_blend_decompress);
-       sctx->b.b.delete_blend_state(&sctx->b.b, sctx->custom_blend_fastclear);
+       if (sctx->custom_dsa_flush)
+               sctx->b.b.delete_depth_stencil_alpha_state(&sctx->b.b, 
sctx->custom_dsa_flush);
+       if (sctx->custom_blend_resolve)
+               sctx->b.b.delete_blend_state(&sctx->b.b, 
sctx->custom_blend_resolve);
+       if (sctx->custom_blend_decompress)
+               sctx->b.b.delete_blend_state(&sctx->b.b, 
sctx->custom_blend_decompress);
+       if (sctx->custom_blend_fastclear)
+               sctx->b.b.delete_blend_state(&sctx->b.b, 
sctx->custom_blend_fastclear);
        util_unreference_framebuffer_state(&sctx->framebuffer.state);
 
-       util_blitter_destroy(sctx->blitter);
+       if (sctx->blitter)
+               util_blitter_destroy(sctx->blitter);
 
        si_pm4_cleanup(sctx);
 

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to