fix: harden screen selection in RvApplication against invalid indices (#1211)#1321
Open
pjurkas wants to merge 1 commit into
Open
fix: harden screen selection in RvApplication against invalid indices (#1211)#1321pjurkas wants to merge 1 commit into
pjurkas wants to merge 1 commit into
Conversation
- Guard isVirtualDesktop against null primary screen and null screens - Use QGuiApplication::screenAt() for more robust point-to-screen mapping, with a manual geometry fallback - Validate opts.screen index before applying it, so stale preferences or out-of-bounds command-line values do not propagate - Bounds-check screen indices and null-check QScreen pointers before dereferencing geometry() in the relative-position adjustment path
pjurkas
requested review from
bernie-laberge,
cedrik-fuoco-adsk and
eloisebrosseau
as code owners
June 30, 2026 00:27
|
|
| QRect totalGeometry; | ||
| for (const auto& screen : screens) | ||
| { | ||
| if (screen == nullptr) |
Contributor
There was a problem hiding this comment.
Could you add curly braces? That style is not followed everywhere, but we are trying to add curly braces whenever we can.
Contributor
|
Thank you @pjurkas! Could you run the pre-commit hook and fix the DCO issue? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked issues
Fixes #1211
Summarize your change.
Harden screen selection in
RvApplicationagainst invalidQScreenindices andnull pointers so OpenRV no longer crashes (SIGSEGV in
QScreen::geometry()) atstartup when multiple displays are connected.
Describe the reason for the change.
Issue #1211 reports a SIGSEGV in
Rv::RvApplication::newSessionFromFiles→QScreen::geometry()on multi-monitor setups (RHEL 9.5). The crash happensbecause the existing code dereferences
QScreen*values that can benullptr,and indexes into
QGuiApplication::screens()with values (from savedpreferences or
-screencommand-line options) that may be out of range orstale. Under certain GNOME multi-display configurations the primary screen or
the requested screen index is not what the code assumes, and we crash.
Describe what you have tested and on which operating system.
configurations that previously reproduced the SIGSEGV from [Bug]: Crash in RvApplication::newSessionFromFiles while multiple displays are connected. #1211.
-screencommand-line value — falls back gracefullyinstead of crashing.
Add a list of changes, and note any that might need special attention during the review.
src/lib/app/RvCommon/RvApplication.cpp:isVirtualDesktopagainst a null primary screen and null entries inQGuiApplication::screens().QGuiApplication::screenAt()for more robust point-to-screen mapping,with a manual geometry fallback when it returns null.
opts.screenagainst the current screen count before applying it,so stale preferences or out-of-bounds command-line values do not propagate.
QScreen*pointers beforedereferencing
geometry()in the relative-position adjustment path.Reviewer focus: please double-check the fallback path when
QGuiApplication::screenAt()returns null and the chosen index whenopts.screenis invalid — those are the behavioral edges most likely toaffect existing multi-monitor workflows.
If possible, provide screenshots.
N/A — crash fix.