tauri-apps / tauri

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

[bug] [macOS] Window maximize regression in tauri 2.x #6287

Open barabadzhi opened 1 year ago

barabadzhi commented 1 year ago

Describe the bug

Tauri data-tauri-drag-region stopped working correctly in tauri 2.x. At least on macOS. Double clicking the element freezes the app, no action is performed, native stack trace appears.

The same setup works seamlessly in tauri 1.x (1.2.4).

The issue seems to be with handling the __toggleMaximize cmd originated from this call in v2 vs v1.

Reproduction

  1. Crate a new app with latest tauri 2.x tooling on macOS.
  2. Set it up to use "titleBarStyle": "Overlay" and create data-tauri-drag-region element.
  3. Double click the drag element - 💥

Expected behavior

Double clicking data-tauri-drag-region element should maximize/unmaximize window correctly.

Platform and versions

Environment › OS: Mac OS 13.2.0 X64 (M1) › Node.js: 18.14.0 › npm: 9.5.0 › pnpm: 7.27.0 › yarn: 3.4.0 › rustup: 1.25.2 › rustc: 1.67.1 › cargo: 1.67.1 › 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]: 2.0.0-alpha.3, › tauri-build [RUST]: 2.0.0-alpha.1, › tao [RUST]: 0.17.0, › wry [RUST]: 0.26.0,

App › build-type: bundle › CSP: unset › distDir: ../dist › devPath: http://localhost:1420/ › framework: React › bundler: Vite

Stack trace

1   HIToolbox                           0x000000018d5b45c8 _ZN15MenuBarInstance22EnsureAutoShowObserverEv + 120
2   HIToolbox                           0x000000018d5b4188 _ZN15MenuBarInstance14EnableAutoShowEv + 60
3   HIToolbox                           0x000000018d5218bc _ZN15MenuBarInstance21UpdateAggregateUIModeE21MenuBarAnimationStylehhh + 1184
4   HIToolbox                           0x000000018d5b4004 _ZN15MenuBarInstance19SetFullScreenUIModeEjj + 180
5   AppKit                              0x00000001873a3d1c -[NSApplication _setPresentationOptions:instance:flags:] + 956
6   AppKit                              0x0000000187239928 -[NSApplication _updateFullScreenPresentationOptionsForInstance:] + 404
7   CoreFoundation                      0x0000000183e56560 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148
8   CoreFoundation                      0x0000000183ef4044 ___CFXRegistrationPost_block_invoke + 88
9   CoreFoundation                      0x0000000183ef3f8c _CFXRegistrationPost + 440
10  CoreFoundation                      0x0000000183e27b64 _CFXNotificationPost + 708
11  Foundation                          0x0000000184d1738c -[NSNotificationCenter postNotificationName:object:userInfo:] + 88
12  AppKit                              0x00000001873a42a0 spacesNotificationHandler + 96
13  SkyLight                            0x0000000188a91214 _ZN12_GLOBAL__N_123notify_datagram_handlerEj15CGSDatagramTypePvmS1_ + 896
14  SkyLight                            0x0000000188dbd4d4 _ZN21CGSDatagramReadStream26dispatchMainQueueDatagramsEv + 228
15  SkyLight                            0x0000000188dbd3d0 ___ZN21CGSDatagramReadStream15mainQueueWakeupEv_block_invoke + 28
16  libdispatch.dylib                   0x0000000183bf89dc _dispatch_call_block_and_release + 32
17  libdispatch.dylib                   0x0000000183bfa504 _dispatch_client_callout + 20
18  libdispatch.dylib                   0x0000000183c08d1c _dispatch_main_queue_drain + 928
19  libdispatch.dylib                   0x0000000183c0896c _dispatch_main_queue_callback_4CF + 44
20  CoreFoundation                      0x0000000183ea2d40 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
21  CoreFoundation                      0x0000000183e607c0 __CFRunLoopRun + 2036
22  CoreFoundation                      0x0000000183e5f878 CFRunLoopRunSpecific + 612
23  HIToolbox                           0x000000018d53ffa0 RunCurrentEventLoopInMode + 292
24  HIToolbox                           0x000000018d53fde4 ReceiveNextEventCommon + 672
25  HIToolbox                           0x000000018d53fb2c _BlockUntilNextEventMatchingListInModeWithFilter + 72
26  AppKit                              0x00000001870e5838 _DPSNextEvent + 632
27  AppKit                              0x00000001870e49c8 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 728
28  AppKit                              0x00000001870d8df8 -[NSApplication run] + 464
29  MyApp            0x0000000104ef4a68 _ZN60_$LT$$LP$$RP$$u20$as$u20$objc..message..MessageArguments$GT$6invoke17h93f4bec13110e84bE + 76
30  MyApp            0x0000000104ef8f58 _ZN4objc7message8platform15send_unverified28_$u7b$$u7b$closure$u7d$$u7d$17h3ad15df365484db9E + 52
31  MyApp            0x0000000104ef7610 _ZN14objc_exception3try28_$u7b$$u7b$closure$u7d$$u7d$17h4f8f3f6f43a210afE + 44
32  MyApp            0x0000000104ef6244 _ZN14objc_exception10try_no_ret24try_objc_execute_closure17h76a1b23a4ff2cd14E + 76
33  MyApp            0x0000000104f0408c RustObjCExceptionTryCatch + 36
34  MyApp            0x0000000104ef5758 _ZN14objc_exception10try_no_ret17h848f4e1c93c9d31fE + 180
35  MyApp            0x0000000104ef726c _ZN14objc_exception3try17hcb4648ded552c02fE + 72
36  MyApp            0x0000000104efbc30 _ZN4objc9exception3try17h4863554125a4ae1fE + 40
37  MyApp            0x0000000104ef8050 _ZN4objc7message8platform15send_unverified17h67800747ec02b9caE + 136
38  MyApp            0x0000000104c10180 _ZN3tao13platform_impl8platform10event_loop18EventLoop$LT$T$GT$10run_return17h66a09d10e5dabac1E + 1024
39  MyApp            0x0000000104c10f6c _ZN3tao13platform_impl8platform10event_loop18EventLoop$LT$T$GT$3run17h34a7fee9316dbd91E + 52
40  MyApp            0x0000000104bfe02c _ZN4core3cmp9PartialEq2ne17h8615eb2f9c457c34E + 0
41  MyApp            0x0000000104bd8850 _ZN83_$LT$tauri_runtime_wry..Wry$LT$T$GT$$u20$as$u20$tauri_runtime..Runtime$LT$T$GT$$GT$3run17hb2271cd3e0049389E + 444
42  MyApp            0x0000000104c0a2a4 _ZN5tauri3app12App$LT$R$GT$3run17h223600bbeefdc027E + 316
43  MyApp            0x0000000104c0a758 _ZN5tauri3app16Builder$LT$R$GT$3run17heda49075a942d536E + 216
44  MyApp            0x0000000104ced9c4 _ZN22my_app10AppBuilder3run17he325f26e0341df84E + 7524
45  MyApp            0x0000000104bcd314 _ZN22my_app4main17h0540cf39002af3b7E + 16
46  MyApp            0x0000000104bcd384 _ZN4core3ops8function6FnOnce9call_once17h4946e84198b2e750E + 20
47  MyApp            0x0000000104bcd23c _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h948d647d805049d1E + 24
48  MyApp            0x0000000104bcd2e4 _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h241c52cf549270a6E + 28
49  MyApp            0x00000001051847bc _ZN3std2rt19lang_start_internal17h00a235e820a7f01cE + 616
50  MyApp            0x0000000104bcd2b0 _ZN3std2rt10lang_start17hae866a14189fd791E + 84
51  MyApp            0x0000000104bcd340 main + 36
52  dyld                                0x0000000183a57e50 start + 2544
1   HIToolbox                           0x000000018d53f90c _ZN15MenuBarInstance22RemoveAutoShowObserverEv + 44
2   HIToolbox                           0x000000018d5b4fbc _ZN15MenuBarInstance15DisableAutoShowEv + 36
3   HIToolbox                           0x000000018d5b50b0 _ZN15MenuBarInstanceD2Ev + 128
4   HIToolbox                           0x000000018d5b4ee0 _ZN15MenuBarInstance7ReleaseEv + 56
5   AppKit                              0x00000001877414dc -[NSHIPresentationInstance discard] + 228
6   AppKit                              0x0000000187b008b4 -[_NSFullScreenSpace(PresentationInstance) discardPresentationInstance] + 32
7   AppKit                              0x0000000187b0090c -[_NSFullScreenSpace(PresentationInstance) activateFullScreenPresentationOptions] + 64
8   AppKit                              0x000000018795a968 -[_NSExitFullScreenTransitionController _doSucceededToExitFullScreen] + 40
9   AppKit                              0x000000018795b440 __63-[_NSExitFullScreenTransitionController _performExitFullScreen]_block_invoke + 236
10  libxpc.dylib                        0x0000000183af242c _xpc_connection_reply_callout + 124
11  libxpc.dylib                        0x0000000183af231c _xpc_connection_call_reply_async + 88
12  libdispatch.dylib                   0x0000000183bfa584 _dispatch_client_callout3 + 20
13  libdispatch.dylib                   0x0000000183c18710 _dispatch_mach_msg_async_reply_invoke + 344
14  libdispatch.dylib                   0x0000000183c08c70 _dispatch_main_queue_drain + 756
15  libdispatch.dylib                   0x0000000183c0896c _dispatch_main_queue_callback_4CF + 44
16  CoreFoundation                      0x0000000183ea2d40 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
17  CoreFoundation                      0x0000000183e607c0 __CFRunLoopRun + 2036
18  CoreFoundation                      0x0000000183e5f878 CFRunLoopRunSpecific + 612
19  HIToolbox                           0x000000018d53ffa0 RunCurrentEventLoopInMode + 292
20  HIToolbox                           0x000000018d53fde4 ReceiveNextEventCommon + 672
21  HIToolbox                           0x000000018d53fb2c _BlockUntilNextEventMatchingListInModeWithFilter + 72
22  AppKit                              0x00000001870e5838 _DPSNextEvent + 632
23  AppKit                              0x00000001870e49c8 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 728
24  AppKit                              0x00000001870d8df8 -[NSApplication run] + 464
25  MyApp            0x0000000104ef4a68 _ZN60_$LT$$LP$$RP$$u20$as$u20$objc..message..MessageArguments$GT$6invoke17h93f4bec13110e84bE + 76
26  MyApp            0x0000000104ef8f58 _ZN4objc7message8platform15send_unverified28_$u7b$$u7b$closure$u7d$$u7d$17h3ad15df365484db9E + 52
27  MyApp            0x0000000104ef7610 _ZN14objc_exception3try28_$u7b$$u7b$closure$u7d$$u7d$17h4f8f3f6f43a210afE + 44
28  MyApp            0x0000000104ef6244 _ZN14objc_exception10try_no_ret24try_objc_execute_closure17h76a1b23a4ff2cd14E + 76
29  MyApp            0x0000000104f0408c RustObjCExceptionTryCatch + 36
30  MyApp            0x0000000104ef5758 _ZN14objc_exception10try_no_ret17h848f4e1c93c9d31fE + 180
31  MyApp            0x0000000104ef726c _ZN14objc_exception3try17hcb4648ded552c02fE + 72
32  MyApp            0x0000000104efbc30 _ZN4objc9exception3try17h4863554125a4ae1fE + 40
33  MyApp            0x0000000104ef8050 _ZN4objc7message8platform15send_unverified17h67800747ec02b9caE + 136
34  MyApp            0x0000000104c10180 _ZN3tao13platform_impl8platform10event_loop18EventLoop$LT$T$GT$10run_return17h66a09d10e5dabac1E + 1024
35  MyApp            0x0000000104c10f6c _ZN3tao13platform_impl8platform10event_loop18EventLoop$LT$T$GT$3run17h34a7fee9316dbd91E + 52
36  MyApp            0x0000000104bfe02c _ZN4core3cmp9PartialEq2ne17h8615eb2f9c457c34E + 0
37  MyApp            0x0000000104bd8850 _ZN83_$LT$tauri_runtime_wry..Wry$LT$T$GT$$u20$as$u20$tauri_runtime..Runtime$LT$T$GT$$GT$3run17hb2271cd3e0049389E + 444
38  MyApp            0x0000000104c0a2a4 _ZN5tauri3app12App$LT$R$GT$3run17h223600bbeefdc027E + 316
39  MyApp            0x0000000104c0a758 _ZN5tauri3app16Builder$LT$R$GT$3run17heda49075a942d536E + 216
40  MyApp            0x0000000104ced9c4 _ZN22my_app10AppBuilder3run17he325f26e0341df84E + 7524
41  MyApp            0x0000000104bcd314 _ZN22my_app4main17h0540cf39002af3b7E + 16
42  MyApp            0x0000000104bcd384 _ZN4core3ops8function6FnOnce9call_once17h4946e84198b2e750E + 20
43  MyApp            0x0000000104bcd23c _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h948d647d805049d1E + 24
44  MyApp            0x0000000104bcd2e4 _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h241c52cf549270a6E + 28
45  MyApp            0x00000001051847bc _ZN3std2rt19lang_start_internal17h00a235e820a7f01cE + 616
46  MyApp            0x0000000104bcd2b0 _ZN3std2rt10lang_start17hae866a14189fd791E + 84
47  MyApp            0x0000000104bcd340 main + 36
48  dyld                                0x0000000183a57e50 start + 2544

Additional context

No response

bleroux commented 1 year ago

FYI, Apple fixed this issue on Ventura 13.3.1.