fix: guard against null rect in Node.set rect - #541
Open
OddballGreg wants to merge 1 commit into
Open
OddballGreg wants to merge 1 commit into
OddballGreg wants to merge 1 commit into
Conversation
A WINDOW node is allowed to hold a null rect, since its branch in the
setter breaks immediately and never touches an actor. split() then copies
that value onto a newly created CON node via `newConNode.rect = node.rect`,
and the CON branch does dereference it, so set_size() throws.
This surfaces as an unhandled `TypeError: rect is null` at tree.js:129,
reached from trackWindow() -> command("Split") -> split() when
auto-split-enabled is true and the window has not been through a
renderTree pass yet, so its rect is still unset.
The throw escapes a display "workareas-changed" handler, which runs while
mutter is reconfiguring monitors and work areas.
Guard the actor geometry calls instead of the assignment, since any caller
can reach the setter with a null rect. The node still records _rect = null
and the following renderTree assigns a real rect and sizes the actor, so
there is no visual change.
Refs forge-ext#540
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.
Fixes the unhandled
TypeError: rect is nullreported in #540.The bug
Node.set rectlets aWINDOWnode hold a null rect, because that case breaks immediately and never touches an actor.split()then copies that value onto a freshly createdCONnode:The
CONbranch does dereference it, soset_size()throws:Reached when
auto-split-enabledis true (the default), sincetrackWindowissues aSplitcommand before the new window has been through arenderTreepass and therefore before it has any geometry.This matters more than a log line because the throw escapes a display
workareas-changedhandler, which runs while mutter is reconfiguring monitors and work areas. See #540 for the display-side symptoms I measured alongside it.The change
Guards the actor geometry calls rather than the assignment in
split(), on the grounds that any caller can reach the setter with a null rect, so the setter is the right place to be defensive.The node still records
_rect = null. Only the two actor geometry calls are skipped, and the followingrenderTreeassigns a real rect and sizes the actor, so there is no visual change.Verification
prettier@2frompackage.json: the file is clean both before and after the change. (Noteprettier@3reports pre-existing issues in this file, unrelated to this PR, so I left them alone rather than bloat the diff.)node --checkpasses.