freedreno: fix crash if ctx torn down with no rendering
authorRob Clark <robdclark@gmail.com>
Sat, 15 Apr 2017 16:32:17 +0000 (12:32 -0400)
committerRob Clark <robdclark@gmail.com>
Mon, 17 Apr 2017 18:00:05 +0000 (14:00 -0400)
In this case, ctx->flush_queue would not have been initialized.

Fixes: 0b613c20 ("freedreno: enable draw/batch reordering by default")
Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
src/gallium/drivers/freedreno/freedreno_context.c

index 4d8c4251a8b7cf357b3f2717d1291c0245aed1ff..6478e0e7a9c5be4d7b3e5a4b557c4e995a709278 100644 (file)
@@ -112,7 +112,7 @@ fd_context_destroy(struct pipe_context *pctx)
 
        DBG("");
 
-       if (ctx->screen->reorder)
+       if (ctx->screen->reorder && util_queue_is_initialized(&ctx->flush_queue))
                util_queue_destroy(&ctx->flush_queue);
 
        fd_batch_reference(&ctx->batch, NULL);  /* unref current batch */