aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-05-17 15:49:41 +0200
committerdec05eba <dec05eba@protonmail.com>2021-05-17 15:49:41 +0200
commit596a6b9edddfd79af9877695974c669d18730ed3 (patch)
tree1a1bac95a2e938e5fae03e7a3108865d4090092a
parente2121ee4fd0cd0b1e3f2a857043d8135f4450731 (diff)
Possible crash fix for old nvidia proprietary driver with randr
-rw-r--r--src/QuickMedia.cpp7
1 files changed, 5 insertions, 2 deletions
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::function<void(
for(int i = 0; i < screen_res->noutput; ++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);