vo_opengl: don't crash win32 backend with NULL events

vo_opengl was crashing since f811348d because it passed NULL for the
events parameter to vo_control. Normally the parameter should not be
NULL, so add a hack to account for this. In particular, we should
handle the events that are returned. For the call in preinit() we
skip this, but it most likely has no meaning anyway, because in this
stage no window is visible yet.
This commit is contained in:
wm4 2015-01-08 18:27:22 +01:00
parent 88c6f18209
commit f6e466585a
1 changed files with 7 additions and 7 deletions

View File

@ -253,10 +253,10 @@ static bool update_icc_profile(struct gl_priv *p)
return true;
}
static bool get_and_update_icc_profile(struct gl_priv *p)
static bool get_and_update_icc_profile(struct gl_priv *p, int *events)
{
bstr icc;
int r = p->glctx->vo_control(p->vo, NULL, VOCTRL_GET_ICC_PROFILE, &icc);
int r = p->glctx->vo_control(p->vo, events, VOCTRL_GET_ICC_PROFILE, &icc);
if (r == VO_FALSE) {
MP_WARN(p->vo, "Could not retrieve an ICC profile.\n");
@ -373,14 +373,14 @@ static int control(struct vo *vo, uint32_t request, void *data)
mpgl_lock(p->glctx);
int events = 0;
int r = p->glctx->vo_control(vo, &events, request, data);
if (events & VO_EVENT_ICC_PROFILE_PATH_CHANGED) {
get_and_update_icc_profile(p, &events);
vo->want_redraw = true;
}
if (events & VO_EVENT_RESIZE)
resize(p);
if (events & VO_EVENT_EXPOSE)
vo->want_redraw = true;
if (events & VO_EVENT_ICC_PROFILE_PATH_CHANGED) {
get_and_update_icc_profile(p);
vo->want_redraw = true;
}
vo_event(vo, events);
mpgl_unlock(p->glctx);
@ -433,7 +433,7 @@ static int preinit(struct vo *vo)
if (!p->cms)
goto err_out;
gl_lcms_set_options(p->cms, p->icc_opts);
if (!get_and_update_icc_profile(p))
if (!get_and_update_icc_profile(p, &(int){0}))
goto err_out;
mpgl_unset_context(p->glctx);