Skip to content

[bug] App hangs on creating a new window, with window-state and single-instance installed #2088

Open
@hut36

Description

@hut36

Description

With window-state and single-instance installed, app hangs when creating a new window from single-instance's init() function.

Steps to reproduce

This is the repo to reproduce: https://github.com/hut36/tauri-window-hang

Steps to reproduce with the provided repo:

  1. pnpm i && pnpm tauri build --debug. This produces tauri-window-hang.exe;
  2. Launch the app by double-clicking tauri-window-hang.exe. This opens Window 1;
  3. Double-click tauri-window-hang.exe, this opens Main Window;
  4. Close Main Window;
  5. Double-click tauri-window-hang.exe again, this is to open Main Window. App hangs here.

Alternative steps to reproduce the problem with the provided repo:

  1. pnpm i && pnpm tauri build --debug. This produces tauri-window-hang.exe;
  2. Launch the app by double-clicking tauri-window-hang.exe. This opens Window 1;
  3. Double-click tauri-window-hang.exe, this opens Main Window;
  4. Quit the app by closing all windows. This is to ensure windows' states are saved to disk;
  5. Repeat steps 2 and 3, now app hangs on step 3.

If plugin window-state is removed(comment out line .plugin(tauri_plugin_window_state::Builder::new().build())), then it'll be successful to create Main Window.

Expected behaviour

Window is created without any problem.

tauri info

[✔] Environment
    - OS: Windows 10.0.22631 x86_64 (X64)
    ✔ WebView2: 130.0.2849.56
    ✔ MSVC: Visual Studio 生成工具 2022
    ✔ rustc: 1.82.0 (f6e511eec 2024-10-15)
    ✔ cargo: 1.82.0 (8f40fc59f 2024-08-21)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 20.12.0
    - pnpm: 9.10.0
    - yarn: 1.22.22
    - npm: 9.6.3

[-] Packages
    - tauri 🦀: 2.1.1
    - tauri-build 🦀: 2.0.3
    - wry 🦀: 0.47.2
    - tao 🦀: 0.30.8
    - @tauri-apps/api : 2.1.1
    - @tauri-apps/cli : 2.1.0

[-] Plugins
    - tauri-plugin-shell 🦀: 2.0.2
    - @tauri-apps/plugin-shell : 2.0.1
    - tauri-plugin-window-state 🦀: 2.0.2
    - @tauri-apps/plugin-window-state : not installed!
    - tauri-plugin-single-instance 🦀: 2.0.1
    - @tauri-apps/plugin-single-instance : not installed!

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../build
    - devUrl: http://localhost:1420/
    - framework: Svelte
    - bundler: Vite

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions