vo_d3d11/context: fix crash due to ctx->ra is null pointer access

'ctx->ra' is null pointer when d3d11 init failed before call 'ra_d3d11_create' in 'd3d11_init'.
This commit is contained in:
Hui Jin 2019-07-26 13:28:00 +08:00 committed by James Ross-Gowan
parent 191737b9c9
commit fda45f4537
1 changed files with 4 additions and 2 deletions

View File

@ -161,14 +161,16 @@ static void d3d11_uninit(struct ra_ctx *ctx)
{
struct priv *p = ctx->priv;
ra_tex_free(ctx->ra, &p->backbuffer);
if (ctx->ra)
ra_tex_free(ctx->ra, &p->backbuffer);
SAFE_RELEASE(p->swapchain);
vo_w32_uninit(ctx->vo);
SAFE_RELEASE(p->device);
// Destory the RA last to prevent objects we hold from showing up in D3D's
// leak checker
ctx->ra->fns->destroy(ctx->ra);
if (ctx->ra)
ctx->ra->fns->destroy(ctx->ra);
}
static const struct ra_swapchain_fns d3d11_swapchain = {