tauri-apps / tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
https://tauri.app
Apache License 2.0
82.69k stars 2.48k forks source link

Right-click on tray crashes the app [bug] [next] #6271

Closed morajabi closed 1 year ago

morajabi commented 1 year ago

Describe the bug

tray crashes on right click (branch next). cc @wusyong moved from Discord https://discord.com/channels/616186924390023171/807549941936816148/1074839730740539402

tray
    .with_menu(menu)
    .with_id("icon")
    .with_menu_on_left_click(false) # changing this did not have an effect
    .with_icon_as_template(true)

error:

thread 'main' panicked at 'Uncaught exception <NSException: 0x600000eb7390>', /Users/mo/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:3740:9

Commit causing it seems like https://github.com/tauri-apps/tauri/commit/1092865e67647112b5ed8b1bb0359b5ba2a934bd

Reproduction

  1. checkout next branch
  2. run the api example
  3. right click

Expected behavior

not crash

Platform and versions

Environment › OS: Mac OS 13.0.0 X64 › Node.js: 18.11.0 › npm: 8.19.2 › pnpm: 7.22.0 › yarn: 1.22.10 › rustup: 1.25.2 › rustc: 1.67.0 › cargo: 1.67.0 › Rust toolchain: stable-aarch64-apple-darwin

Packages › @tauri-apps/cli [NPM]: 2.0.0-alpha.2 › @tauri-apps/api [NPM]: 2.0.0-alpha.0 › tauri [RUST]: git+https://github.com/tauri-apps/tauri?branch=next#65e487f344de70f25eaf61a7914bb79eee59d26d (2.0.0-alpha.3), › tauri-build [RUST]: no manifest (2.0.0-alpha.1, 2.0.0-alpha.1), › tao [RUST]: 0.18.0, › wry [RUST]: git+https://github.com/tauri-apps/wry?rev=9975dda12a122051b375ec6485650546d2d91c26#9975dda12a122051b375ec6485650546d2d91c26 (0.27.0),

App › build-type: bundle › CSP: default-src 'self' blob: data: filesystem: ws: http: https: tauri: 'wasm-unsafe-eval' 'unsafe-eval' 'unsafe-inline'; script-src 'self' 'wasm-unsafe-eval' tauri: https://unpkg.com/@june-so/analytics-next/dist/umd/standalone.js; style-src 'unsafe-inline' 'self'; img-src 'self' blob: data: tauri: filesystem: https: asset: https://asset.localhost; › distDir: ../app/dist › devPath: http://localhost:4001/ › framework: React › bundler: Webpack

App directory structure ├─ .husky ├─ tsbuild ├─ sun ├─ .fly ├─ app ├─ tauri ├─ node_modules ├─ prisma ├─ .storybook ├─ components ├─ common ├─ scripts ├─ .github ├─ .git └─ .vscode

Stack trace

VM Region Info: 0x4d555478 is not in any region.  Bytes before following region: 3042126728
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                      102a88000-105dac000    [ 51.1M] r-x/r-x SM=COW  ...s/USER/*/Noor

Thread 0 Crashed:: main Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib                          0x1a277fb80 objc_retain + 16
1   AppKit                                   0x1a64bf098 -[NSStatusItem setMenu:] + 60
2   Noor                                     0x104e2f314 _$LT$$LP$A$C$$RP$$u20$as$u20$objc..message..M

Additional context

No response

lucasfernog commented 1 year ago

Fixed by https://github.com/tauri-apps/tao/pull/699

morajabi commented 1 year ago

Thanks @lucasfernog, going to test it now

wusyong commented 1 year ago

tao 0.18.1 has published. It can be fixed by running cargo update. https://github.com/tauri-apps/tao/releases/tag/tao-v0.18.1