summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-11-23 10:54:34 +0100
committerwm4 <wm4@nowhere>2014-11-23 10:54:34 +0100
commitc9fdf4308c1ee9e469ba3523f1e848f3e4d8545e (patch)
tree5fb11abebfe2a8ffd9c0269ee2854a6ff42df936
parent4cdd3462469dc9c88f73397576c94792b37c23dc (diff)
downloadmpv-c9fdf4308c1ee9e469ba3523f1e848f3e4d8545e.tar.bz2
mpv-c9fdf4308c1ee9e469ba3523f1e848f3e4d8545e.tar.xz
x11: fix crash with --wid=0 and vo_xv/vo_x11
But seriously, don't use --wid=0, don't use vo_xv, and _especially_ don't use vo_x11. Fixes #1284.
-rw-r--r--video/out/x11_common.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index b8544ef398..aa1aab1edf 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -1213,8 +1213,6 @@ static void vo_x11_create_window(struct vo *vo, XVisualInfo *vis,
vis->depth, CopyFromParent, vis->visual, xswamask, &xswa);
Atom protos[1] = {XA(x11, WM_DELETE_WINDOW)};
XSetWMProtocols(x11->display, x11->window, protos, 1);
- x11->f_gc = XCreateGC(x11->display, x11->window, 0, 0);
- x11->vo_gc = XCreateGC(x11->display, x11->window, 0, NULL);
XSetForeground(x11->display, x11->f_gc, 0);
if (x11->mouse_cursor_hidden) {
@@ -1351,6 +1349,11 @@ void vo_x11_config_vo_window(struct vo *vo, XVisualInfo *vis, int flags,
x11->winrc = geo.win;
}
+ if (!x11->f_gc && !x11->vo_gc) {
+ x11->f_gc = XCreateGC(x11->display, x11->window, 0, 0);
+ x11->vo_gc = XCreateGC(x11->display, x11->window, 0, NULL);
+ }
+
if (flags & VOFLAG_HIDDEN)
return;