Fix crash when drag detaching Chrome tabs #1095
Merged
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 #1069
When detaching tabs from Chrome by dragging them out of the current window, PaperWM calls
layoutGrabColumnwith a nullselectedWindow, causing the layout recalculation to crash.This PR changes it to pass
inGrab.windowdirectly for thegrabWindowparameter, which seems to match the if predicate better too.I also fixed an incidental crash when formatting the error in
layoutGrabColumnwhen null gets passed in.Finally, when testing this out, I noticed that
layoutGrabColumnpositions the detached window with a somewhat arbitrary seeming y position (seems to be based on where it was created on detach):Screencast.From.2025-10-13.17-59-33.mp4
Adding
inGrab.dndto the predicate uses the normal layout function and prevents this behavior:Screencast.From.2025-10-13.17-58-00.mp4
I don't yet fully understand the cases where
layoutGrabColumnis important, but it seems like the gap preservation only matters when we're in the fully engaged "DnD grab" where the window is pulled out of the layout and being moved to a new tiled position.There's still a little funkiness I've seen occasionally in testing, but this change prevents the stateful layout corruption described in the original issue.