Commit 3ed72705 authored by Tapani Pälli's avatar Tapani Pälli Committed by Dylan Baker
Browse files

mesa/st: call memobj_destroy only if there is memory imported

Something may go wrong during import which leaves pointer to null and
when ctx and it's shared state gets destroyed we will attempt to call
memobj_destroy. Instead of forcing every driver to handle it, add check

Fixes crashes with Piglit test:

Fixes: 99cf9108

 ("mesa/st: Actually free the driver part of memory objects on destruction.")
Signed-off-by: Tapani Pälli's avatarTapani Pälli <>
Reviewed-by: Lionel Landwerlin's avatarLionel Landwerlin <>
Reviewed-by: Eleni Maria Stea's avatarEleni Maria Stea <>
Part-of: <!7403>
(cherry picked from commit e02e1ccb)
parent 18a97626
......@@ -5143,7 +5143,7 @@
"description": "mesa/st: call memobj_destroy only if there is memory imported",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": "99cf9108340c2ccf7c1b05ec6f951e2e91b9c76c"
......@@ -59,7 +59,8 @@ st_memoryobj_free(struct gl_context *ctx,
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
screen->memobj_destroy(screen, st_obj->memory);
if (st_obj->memory)
screen->memobj_destroy(screen, st_obj->memory);
_mesa_delete_memory_object(ctx, obj);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment