fix(runtime): clamp oversized window dimensions (fix #15648)#15649
fix(runtime): clamp oversized window dimensions (fix #15648)#15649justjavac wants to merge 2 commits into
Conversation
d79e09c to
56fd19b
Compare
56fd19b to
7783bb8
Compare
|
|
||
| fn inner_size(mut self, width: f64, height: f64) -> Self { | ||
| self.inner = self.inner.with_inner_size(LogicalSize::new(width, height)); | ||
| self.inner = self.inner.with_inner_size(LogicalSize::new( |
There was a problem hiding this comment.
It would be good to know where exactly crashed and fixing that instead of clamping the values here (there're another bug and this just makes it harder to find)
There was a problem hiding this comment.
Thanks, updated in aed6a5d.
I moved the clamp out of WindowBuilderWrapper::inner_size; that builder method now preserves the caller-provided size. The size is now capped only on macOS immediately before creating the window, using the monitor scale factor and capping the physical initial size to i32::MAX. This is the path that feeds tao/AppKit window creation instead of clamping every builder input.
Validation I ran:
- Reproduced the original crash on an unpatched checkout by setting
examples/helloworldwidth to2147483648and runningRUST_BACKTRACE=full cargo run -p tauri --example helloworld. It aborts withpanic in a function that cannot unwind, attao::platform_impl::platform::app_delegate::did_finish_launching. - Ran the same oversized config on this branch; the app entered the event loop with no panic, then I stopped it manually.
- Added unit coverage that
inner_sizepreserves oversized input, safe macOS values are left unchanged, oversized values are capped, and scale factor is accounted for. cargo fmt --checkcargo test -p tauri-runtime-wry --libcargo check -p tauri-runtime-wrygit diff --check
There was a problem hiding this comment.
It sounds like a tao issue to me? We should probably fix it there
|
Moved the fix upstream to tao as suggested: tauri-apps/tao#1259. The tao PR clamps oversized macOS initial inner window dimensions before constructing the native Validation run on the tao branch:
Earlier Tauri-side reproduction: setting the helloworld example width to |
What changed
tauri-runtime-wry.Closes #15648.
Testing
cargo fmt -p tauri-runtime-wrycargo check -p tauri-runtime-wrygit diff --check