diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-02-27 12:45:11 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-02-27 12:45:11 +0100 |
commit | deed9799f5a8edc49d9747cfef3394999b59b54f (patch) | |
tree | 328dc1d992071d5aec23e94099e244c086ab380a | |
parent | b49f42a3164ad466e4a783bd825c82aeb1fabacc (diff) |
Fix crash with certain monitor setups
-rw-r--r-- | src/QuickMedia.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 7eb36ca..dd5b025 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -79,14 +79,16 @@ static int get_monitor_max_hz(Display *display) { 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) { - XRRCrtcInfo* crt_info = XRRGetCrtcInfo(display, screen_res, out_info->crtc); - const XRRModeInfo *mode_info = get_mode_info(screen_res, crt_info->mode); - if(mode_info) { - unsigned long total = mode_info->hTotal * mode_info->vTotal; - if(total > 0) - max_hz = std::max(max_hz, mode_info->dotClock / total); + XRRCrtcInfo *crt_info = XRRGetCrtcInfo(display, screen_res, out_info->crtc); + if(crt_info) { + const XRRModeInfo *mode_info = get_mode_info(screen_res, crt_info->mode); + if(mode_info) { + unsigned long total = mode_info->hTotal * mode_info->vTotal; + if(total > 0) + max_hz = std::max(max_hz, mode_info->dotClock / total); + } + XRRFreeCrtcInfo(crt_info); } - XRRFreeCrtcInfo(crt_info); } if(out_info) XRRFreeOutputInfo(out_info); @@ -1769,7 +1771,7 @@ namespace QuickMedia { related_videos = video_page->get_related_media(video_url, channel_url); // TODO: Make this also work for other video plugins - if(strcmp(plugin_name, "youtube") != 0) + if(strcmp(plugin_name, "youtube") != 0 || resume_video) return; std::string video_id; |