diff options
author | wm4 <wm4@mplayer2.org> | 2011-10-24 04:51:24 +0200 |
---|---|---|
committer | Uoti Urpala <uau@mplayer2.org> | 2011-10-24 08:36:17 +0300 |
commit | b200583403219136363b755afab2b05c0937a928 (patch) | |
tree | e828b37713b14ac7a6d24cdc0a1c5abced133415 /libvo/vo_gl.c | |
parent | 2123bff6fa24d43dfc5768ddc0ca855819f0b1b0 (diff) | |
download | mpv-b200583403219136363b755afab2b05c0937a928.tar.bz2 mpv-b200583403219136363b755afab2b05c0937a928.tar.xz |
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.
Diffstat (limited to 'libvo/vo_gl.c')
-rw-r--r-- | libvo/vo_gl.c | 6 |
1 files changed, 6 insertions, 0 deletions
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: |