-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix(linux): guard XRandR NULL returns to avoid a SEGV during display setup #5644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -513,6 +513,10 @@ namespace platf { | |
| } | ||
|
|
||
| screen_res_t screenr {x11::rr::GetScreenResources(xdisplay.get(), xwindow)}; | ||
| if (!screenr) { | ||
| BOOST_LOG(error) << "Could not query X screen resources"sv; | ||
| return -1; | ||
| } | ||
| int output = screenr->noutput; | ||
|
|
||
| output_info_t result; | ||
|
|
@@ -531,8 +535,12 @@ namespace platf { | |
| } | ||
| } | ||
|
|
||
| crtc_info_t crt_info; | ||
| if (result_found && result->crtc) { | ||
| crtc_info_t crt_info {x11::rr::GetCrtcInfo(xdisplay.get(), screenr.get(), result->crtc)}; | ||
| crt_info = crtc_info_t {x11::rr::GetCrtcInfo(xdisplay.get(), screenr.get(), result->crtc)}; | ||
| } | ||
|
|
||
| if (crt_info) { | ||
| BOOST_LOG(info) | ||
| << "Streaming display: "sv << result->name << " with res "sv << crt_info->width << 'x' << crt_info->height << " offset by "sv << crt_info->x << 'x' << crt_info->y; | ||
|
|
||
|
|
@@ -942,6 +950,10 @@ namespace platf { | |
|
|
||
| auto xwindow = DefaultRootWindow(xdisplay.get()); | ||
| screen_res_t screenr {x11::rr::GetScreenResources(xdisplay.get(), xwindow)}; | ||
| if (!screenr) { | ||
| BOOST_LOG(error) << "Could not query X screen resources"sv; | ||
| return {}; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P2] If |
||
| } | ||
| int output = screenr->noutput; | ||
|
|
||
| std::vector<std::string> names; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1] A transient null
XRRGetCrtcInforesult for a successfully matched, selected monitor now takes the existing whole-desktop branch and returns success. Both X11 capture paths then usexattr.width/heightfrom the root window, so a stream configured for one monitor can show every monitor for the lifetime of that capture object. Please fail initialization for this lookup error (as the screen-resources guard does) so the existing display reset/retry path can recover without changing the captured area.