radeonsi: avoid stale pointers in si_delete_shader_selector
authorChristian König <christian.koenig@amd.com>
Sat, 8 Mar 2014 13:16:23 +0000 (14:16 +0100)
committerChristian König <christian.koenig@amd.com>
Sat, 8 Mar 2014 15:08:15 +0000 (16:08 +0100)
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeonsi/si_state.c

index 8f90000eea0fb3b4fa25a13260af9c718f236948..0ee415406d2dce133523b556c7934137263ae154 100644 (file)
@@ -2356,7 +2356,12 @@ static void si_delete_shader_selector(struct pipe_context *ctx,
 
        while (p) {
                c = p->next_variant;
-               si_pm4_delete_state(sctx, vs, p->pm4);
+               if (sel->type == PIPE_SHADER_GEOMETRY)
+                       si_pm4_delete_state(sctx, gs, p->pm4);
+               else if (sel->type == PIPE_SHADER_FRAGMENT)
+                       si_pm4_delete_state(sctx, ps, p->pm4);
+               else
+                       si_pm4_delete_state(sctx, vs, p->pm4);
                si_pipe_shader_destroy(ctx, p);
                free(p);
                p = c;