Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Centering application window with width or height that is bigger than the current screen size results in app crash #2978

Closed
srg-kostyrko opened this issue Nov 28, 2021 · 1 comment

Comments

@srg-kostyrko
Copy link

srg-kostyrko commented Nov 28, 2021

Describe the bug

Centering application window with width or height that is bigger than the current screen size results in app crash with the following message in the console

thread 'main' panicked at 'attempt to subtract with overflow',  C:\Users\srgko\.cargo\registry\src\github.com-1ecc6299db9ec823\tauri-runtime-wry-0.2.1\src\lib.rs:2318:13

To Reproduce

Assuming that current screen size is 1920x1080, follwoing js snippet will crash app

import { appWindow, LogicalSize } from '@tauri-apps/api/window'
await appWindow.setSize(new LogicalSize(2000, 1100)).then(() => appWindow.center());

Expected behavior

No crash when centering window.

Platform and Versions (required):



Operating System - Windows, version 10.0.19042 X64
Webview2 - 96.0.1054.34

Node.js environment
  Node.js - 14.17.0
  @tauri-apps/cli - 1.0.0-beta.10
  @tauri-apps/api - 1.0.0-beta.8

Global packages
  npm - 6.14.13
  yarn - 1.22.11

Rust environment
  rustc - 1.56.0
  cargo - 1.56.0

App directory structure
/.git
/.github
/.husky
/.vscode
/apps
/demo
/dist
/game
/libs
/node_modules
/src-tauri
/tools

App
  tauri.rs - 1.0.0-beta.8
  build-type - bundle
  CSP - default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'
  distDir - ../dist/apps/player-desktop
  devPath - http://localhost:4200
  framework - React

Stack Trace

thread 'main' panicked at 'attempt to subtract with overflow', C:\Users\srgko\.cargo\registry\src\github.com-1ecc6299db9ec823\tauri-runtime-wry-0.2.1\src\lib.rs:2318:13
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa\/library\std\src\panicking.rs:517
   1: core::panicking::panic_fmt
             at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa\/library\core\src\panicking.rs:101
   2: core::panicking::panic
             at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa\/library\core\src\panicking.rs:50
   3: tauri_runtime_wry::center_window
             at C:\Users\srgko\.cargo\registry\src\github.com-1ecc6299db9ec823\tauri-runtime-wry-0.2.1\src\lib.rs:2318
   4: tauri_runtime_wry::handle_event_loop
             at C:\Users\srgko\.cargo\registry\src\github.com-1ecc6299db9ec823\tauri-runtime-wry-0.2.1\src\lib.rs:2036
   5: tauri_runtime_wry::impl$36::run::closure$0<tauri::app::impl$13::run::closure$0>
             at C:\Users\srgko\.cargo\registry\src\github.com-1ecc6299db9ec823\tauri-runtime-wry-0.2.1\src\lib.rs:1798
   6: tao::platform_impl::platform::event_loop::impl$2::run_return::closure$0<enum$<tauri_runtime_wry::Message>,tauri_runtime_wry::impl$36::run::closure$0>
             at C:\Users\srgko\.cargo\registry\src\github.com-1ecc6299db9ec823\tao-0.5.2\src\platform_impl\windows\event_loop.rs:219
   7: alloc::boxed::impl$45::call_mut<tuple$<enum$<tao::event::Event<enum$<tauri_runtime_wry::Message> > >,ref_mut$<enum$<tao::event_loop::ControlFlow> > >,dyn$<core::ops::function::FnMut<tuple$<enum$<tao::event::Event<enum$<tauri_runtime_wry::Message> > >,ref_
             at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa\library\alloc\src\boxed.rs:1643
   8: tao::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure$0<enum$<tauri_runtime_wry::Message> >
             at C:\Users\srgko\.cargo\registry\src\github.com-1ecc6299db9ec823\tao-0.5.2\src\platform_impl\windows\event_loop\runner.rs:249
   9: core::panic::unwind_safe::impl$23::call_once<tuple$<>,tao::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure$0>
             at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa\library\core\src\panic\unwind_safe.rs:271
  10: std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<tao::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure$0>,tuple$<> >
             at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa\library\std\src\panicking.rs:403
  11: hashbrown::raw::bitmask::BitMask::invert
  12: std::panicking::try<tuple$<>,core::panic::unwind_safe::AssertUnwindSafe<tao::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure$0> >
             at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa\library\std\src\panicking.rs:367
  13: std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<tao::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure$0>,tuple$<> >
             at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa\library\std\src\panic.rs:129
  14: tao::platform_impl::platform::event_loop::runner::EventLoopRunner<enum$<tauri_runtime_wry::Message> >::catch_unwind<enum$<tauri_runtime_wry::Message>,tuple$<>,tao::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure$0>
             at C:\Users\srgko\.cargo\registry\src\github.com-1ecc6299db9ec823\tao-0.5.2\src\platform_impl\windows\event_loop\runner.rs:155
  15: tao::platform_impl::platform::event_loop::runner::EventLoopRunner<enum$<tauri_runtime_wry::Message> >::call_event_handler<enum$<tauri_runtime_wry::Message> >
             at C:\Users\srgko\.cargo\registry\src\github.com-1ecc6299db9ec823\tao-0.5.2\src\platform_impl\windows\event_loop\runner.rs:243
  16: tao::platform_impl::platform::event_loop::runner::EventLoopRunner<enum$<tauri_runtime_wry::Message> >::send_event<enum$<tauri_runtime_wry::Message> >
             at C:\Users\srgko\.cargo\registry\src\github.com-1ecc6299db9ec823\tao-0.5.2\src\platform_impl\windows\event_loop\runner.rs:224
  17: tao::platform_impl::platform::event_loop::ThreadMsgTargetSubclassInput<enum$<tauri_runtime_wry::Message> >::send_event<enum$<tauri_runtime_wry::Message> >
             at C:\Users\srgko\.cargo\registry\src\github.com-1ecc6299db9ec823\tao-0.5.2\src\platform_impl\windows\event_loop.rs:113
  18: tao::platform_impl::platform::event_loop::thread_event_target_callback::closure$0<enum$<tauri_runtime_wry::Message> >
             at C:\Users\srgko\.cargo\registry\src\github.com-1ecc6299db9ec823\tao-0.5.2\src\platform_impl\windows\event_loop.rs:2034
  19: core::ops::function::FnOnce::call_once<tao::platform_impl::platform::event_loop::thread_event_target_callback::closure$0,tuple$<> >
             at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa\library\core\src\ops\function.rs:227
  20: core::panic::unwind_safe::impl$23::call_once<isize,tao::platform_impl::platform::event_loop::thread_event_target_callback::closure$0>
             at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa\library\core\src\panic\unwind_safe.rs:271
  21: std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<tao::platform_impl::platform::event_loop::thread_event_target_callback::closure$0>,isize>
             at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa\library\std\src\panicking.rs:403
  22: hashbrown::raw::bitmask::BitMask::invert
  23: std::panicking::try<isize,core::panic::unwind_safe::AssertUnwindSafe<tao::platform_impl::platform::event_loop::thread_event_target_callback::closure$0> >
             at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa\library\std\src\panicking.rs:367
  24: std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<tao::platform_impl::platform::event_loop::thread_event_target_callback::closure$0>,isize>
             at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa\library\std\src\panic.rs:129
  25: tao::platform_impl::platform::event_loop::runner::EventLoopRunner<enum$<tauri_runtime_wry::Message> >::catch_unwind<enum$<tauri_runtime_wry::Message>,isize,tao::platform_impl::platform::event_loop::thread_event_target_callback::closure$0>
             at C:\Users\srgko\.cargo\registry\src\github.com-1ecc6299db9ec823\tao-0.5.2\src\platform_impl\windows\event_loop\runner.rs:155
  26: tao::platform_impl::platform::event_loop::thread_event_target_callback<enum$<tauri_runtime_wry::Message> >
             at C:\Users\srgko\.cargo\registry\src\github.com-1ecc6299db9ec823\tao-0.5.2\src\platform_impl\windows\event_loop.rs:2085
  27: DefSubclassProc
  28: DefSubclassProc
  29: CallWindowProcW
  30: DispatchMessageW
  31: tao::platform_impl::platform::event_loop::EventLoop<enum$<tauri_runtime_wry::Message> >::run_return<enum$<tauri_runtime_wry::Message>,tauri_runtime_wry::impl$36::run::closure$0>
             at C:\Users\srgko\.cargo\registry\src\github.com-1ecc6299db9ec823\tao-0.5.2\src\platform_impl\windows\event_loop.rs:248
  32: tao::platform_impl::platform::event_loop::EventLoop<enum$<tauri_runtime_wry::Message> >::run<enum$<tauri_runtime_wry::Message>,tauri_runtime_wry::impl$36::run::closure$0>
             at C:\Users\srgko\.cargo\registry\src\github.com-1ecc6299db9ec823\tao-0.5.2\src\platform_impl\windows\event_loop.rs:203
  33: tao::event_loop::EventLoop<enum$<tauri_runtime_wry::Message> >::run<enum$<tauri_runtime_wry::Message>,tauri_runtime_wry::impl$36::run::closure$0>
             at C:\Users\srgko\.cargo\registry\src\github.com-1ecc6299db9ec823\tao-0.5.2\src\event_loop.rs:151
  34: tauri_runtime_wry::impl$36::run<tauri::app::impl$13::run::closure$0>
             at C:\Users\srgko\.cargo\registry\src\github.com-1ecc6299db9ec823\tauri-runtime-wry-0.2.1\src\lib.rs:1797
  35: tauri::app::App<tauri_runtime_wry::Wry>::run<tauri_runtime_wry::Wry,tauri::app::impl$15::run::closure$0>
             at C:\Users\srgko\.cargo\registry\src\github.com-1ecc6299db9ec823\tauri-1.0.0-beta.8\src\app.rs:431
  36: tauri::app::Builder<tauri_runtime_wry::Wry>::run<tauri_runtime_wry::Wry,tauri_utils::assets::EmbeddedAssets>
             at C:\Users\srgko\.cargo\registry\src\github.com-1ecc6299db9ec823\tauri-1.0.0-beta.8\src\app.rs:1040
  37: qspider::main
             at .\src\main.rs:47
  38: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
             at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa\library\core\src\ops\function.rs:227
@nothingismagick
Copy link
Sponsor Member

What a great finding! Thanks for the report. ❤️

@srg-kostyrko srg-kostyrko changed the title Resizing application window with width or height that is bigger than the current screen size results in app crash Centering application window with width or height that is bigger than the current screen size results in app crash Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants