diff --git a/src/virglrenderer.c b/src/virglrenderer.c index ac3d401..f752adc 100644 --- a/src/virglrenderer.c +++ b/src/virglrenderer.c @@ -255,6 +255,7 @@ void virgl_renderer_poll(void) void virgl_renderer_cleanup(void *cookie) { + vrend_renderer_fini(); if (use_egl_context) { virgl_egl_destroy(egl_info); egl_info = NULL; diff --git a/src/vrend_decode.c b/src/vrend_decode.c index 166730f..88a2b21 100644 --- a/src/vrend_decode.c +++ b/src/vrend_decode.c @@ -1008,7 +1008,7 @@ void vrend_renderer_context_destroy(uint32_t handle) ret = vrend_destroy_context(ctx->grctx); free(ctx); /* switch to ctx 0 */ - if (ret) + if (ret && handle != 0) vrend_hw_switch_context(dec_ctx[0]->grctx, TRUE); } diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 5327ea3..95cd7b9 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -3177,7 +3177,9 @@ vrend_renderer_fini(void) if (!inited) return; + vrend_renderer_context_destroy(0); vrend_object_fini_resource_table(); + inited = 0; } @@ -3245,6 +3247,7 @@ bool vrend_destroy_context(struct vrend_context *ctx) glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); vrend_bind_va(0); + vrend_object_fini_ctx_table(ctx->res_hash); FREE(ctx); return switch_0;