From f6e466585a1a1ad9b95afe4f98c15e89f21d2fe4 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 8 Jan 2015 18:27:22 +0100 Subject: 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. --- video/out/vo_opengl.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'video/out') diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c index d8269bdb01..8dec7232a0 100644 --- a/video/out/vo_opengl.c +++ b/video/out/vo_opengl.c @@ -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); -- cgit v1.2.3