fix: never pass -0 or NaN to BrowserWindow.setPosition - #236
Merged
alvinunreal merged 1 commit intoSep 25, 2026
Merged
Conversation
Math.round() returns -0 for values in [-0.5, 0), and Electron's setPosition throws "conversion failure" on -0 and NaN. The Calendar Airmail flight crosses x=0 on a display at the origin, so roughly one flight in five threw an uncaught main-process exception. Add setWindowPosition() and route every setPosition call through it.
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 #235
Math.round()returns-0for values between -0.5 and 0, and Electron'ssetPositionthrows on-0andNaN. The Calendar Airmail flight crosses x=0 on a display at the origin, so some flights threw an uncaught main-process exception. With the lid closed, that locks up the whole app.Changes
apps/desktop/src/window-position.tswithsetWindowPosition(window, x, y, animate?). It rounds, turns-0into0, and skips the move if either coordinate isn't finite.setPositioncalls inapps/desktop/srcnow go through it:plugin-delivery.ts,default-pet-controller.ts,agent-pet-controller.ts,lan-pet-controller.ts,plugin-pet-registry.tsandpet-window-context-menu.ts.tests/window-position.test.ts, which covers the exact Airmail tick that lands on-0.Testing
pnpm testinapps/desktoppasses.-0throws before the change and completes the full flight after it.Tested on CachyOS, kernel 7.2.7-1-cachyos, KDE Plasma 6.7.5, Electron 42.0.0.