File tree Expand file tree Collapse file tree
core/tauri-runtime-wry/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ " tauri " : patch
3+ " tauri-runtime-wry " : patch
4+ ---
5+
6+ Reimplement ` remove_system_tray ` on Windows to drop the ` SystemTray ` to run its cleanup code.
Original file line number Diff line number Diff line change @@ -993,6 +993,7 @@ pub enum TrayMessage {
993993 UpdateIcon ( Icon ) ,
994994 #[ cfg( target_os = "macos" ) ]
995995 UpdateIconAsTemplate ( bool ) ,
996+ Close ,
996997}
997998
998999#[ derive( Debug , Clone ) ]
@@ -1565,7 +1566,7 @@ impl RuntimeHandle for WryHandle {
15651566 #[ cfg( all( windows, feature = "system-tray" ) ) ]
15661567 /// Deprecated. (not needed anymore)
15671568 fn remove_system_tray ( & self ) -> Result < ( ) > {
1568- Ok ( ( ) )
1569+ send_user_message ( & self . context , Message :: Tray ( TrayMessage :: Close ) )
15691570 }
15701571}
15711572
@@ -2205,6 +2206,11 @@ fn handle_user_message(
22052206 tray. lock ( ) . unwrap ( ) . set_icon_as_template ( is_template) ;
22062207 }
22072208 }
2209+ TrayMessage :: Close => {
2210+ * tray_context. tray . lock ( ) . unwrap ( ) = None ;
2211+ tray_context. listeners . lock ( ) . unwrap ( ) . clear ( ) ;
2212+ tray_context. items . lock ( ) . unwrap ( ) . clear ( ) ;
2213+ }
22082214 } ,
22092215 Message :: GlobalShortcut ( message) => match message {
22102216 GlobalShortcutMessage :: IsRegistered ( accelerator, tx) => tx
You can’t perform that action at this time.
0 commit comments