From 596a6b9edddfd79af9877695974c669d18730ed3 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 17 May 2021 15:49:41 +0200 Subject: Possible crash fix for old nvidia proprietary driver with randr --- src/QuickMedia.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/QuickMedia.cpp') diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index cd1377a..cf2c0a6 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -118,9 +118,9 @@ static void for_each_active_monitor_output(Display *display, std::functionnoutput; ++i) { XRROutputInfo *out_info = XRRGetOutputInfo(display, screen_res, screen_res->outputs[i]); - if(out_info && out_info->connection == RR_Connected) { + if(out_info && out_info->crtc && out_info->connection == RR_Connected) { XRRCrtcInfo *crt_info = XRRGetCrtcInfo(display, screen_res, out_info->crtc); - if(crt_info) { + if(crt_info && crt_info->mode) { const XRRModeInfo *mode_info = get_mode_info(screen_res, crt_info->mode); if(mode_info) callback_func(crt_info, mode_info); @@ -565,6 +565,9 @@ namespace QuickMedia { if (!disp) throw std::runtime_error("Failed to open display to X11 server"); + XSetErrorHandler(x_error_handler); + XSetIOErrorHandler(x_io_error_handler); + wm_delete_window_atom = XInternAtom(disp, "WM_DELETE_WINDOW", False); int screen = DefaultScreen(disp); -- cgit v1.2.3