vo_opengl_cb: unbreak destroying+recreating GL context

A client API user is allowed to call mpv_opengl_cb_uninit_gl() followed
by mpv_opengl_cb_init_gl(). This crashed; fix it by fixing the lifetime
of ctx->gl.
This commit is contained in:
wm4 2016-02-15 14:50:03 +01:00
parent acf239a45c
commit 012a8ef2cc
1 changed files with 2 additions and 2 deletions

View File

@ -129,8 +129,6 @@ struct mpv_opengl_cb_context *mp_opengl_create(struct mpv_global *g,
pthread_mutex_init(&ctx->lock, NULL);
pthread_cond_init(&ctx->wakeup, NULL);
ctx->gl = talloc_zero(ctx, GL);
ctx->global = g;
ctx->log = mp_log_new(ctx, g->log, "opengl-cb");
ctx->client_api = client_api;
@ -174,6 +172,8 @@ int mpv_opengl_cb_init_gl(struct mpv_opengl_cb_context *ctx, const char *exts,
if (ctx->renderer)
return MPV_ERROR_INVALID_PARAMETER;
ctx->gl = talloc_zero(ctx, GL);
mpgl_load_functions2(ctx->gl, get_proc_address, get_proc_address_ctx,
exts, ctx->log);
ctx->renderer = gl_video_init(ctx->gl, ctx->log, ctx->global);