summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--video/out/x11_common.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index 009f7e4bf6..656509edca 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -280,6 +280,9 @@ static void vo_set_cursor_hidden(struct vo *vo, bool cursor_hidden)
static int x11_errorhandler(Display *display, XErrorEvent *event)
{
struct mp_log *log = x11_error_output;
+ if (!log)
+ return 0;
+
char msg[60];
XGetErrorText(display, event->error_code, (char *) &msg, sizeof(msg));
@@ -746,8 +749,8 @@ void vo_x11_uninit(struct vo *vo)
if (x11->xim)
XCloseIM(x11->xim);
if (x11->display) {
- x11_error_output = NULL;
XSetErrorHandler(NULL);
+ x11_error_output = NULL;
XCloseDisplay(x11->display);
}