From b200583403219136363b755afab2b05c0937a928 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 24 Oct 2011 04:51:24 +0200 Subject: [PATCH] vo_gl: fix crash with backends lacking control() features Some functionality provided by the windowing backend (such as x11, win32) is optional. The function pointers in MPGLContext are NULL if the functionality is not implemented. Check them before calling them, instead of crashing. This happened at least on Windows with the "vo_ontop" command. --- libvo/vo_gl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index 1ab5af6ac3..5f06cf7148 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -1401,6 +1401,8 @@ static int control(struct vo *vo, uint32_t request, void *data) return VO_TRUE; } case VOCTRL_ONTOP: + if (!p->glctx->ontop) + break; p->glctx->ontop(vo); return VO_TRUE; case VOCTRL_FULLSCREEN: @@ -1408,6 +1410,8 @@ static int control(struct vo *vo, uint32_t request, void *data) resize(vo, vo->dwidth, vo->dheight); return VO_TRUE; case VOCTRL_BORDER: + if (!p->glctx->border) + break; p->glctx->border(vo); resize(vo, vo->dwidth, vo->dheight); return VO_TRUE; @@ -1444,6 +1448,8 @@ static int control(struct vo *vo, uint32_t request, void *data) *(struct mp_csp_details *)data = p->colorspace; return VO_TRUE; case VOCTRL_UPDATE_SCREENINFO: + if (!p->glctx->update_xinerama_info) + break; p->glctx->update_xinerama_info(vo); return VO_TRUE; case VOCTRL_REDRAW_OSD: -- 2.11.4.GIT