Browse Source

Fix hidden Win32 TrayIcon appearing after icon updates Preserve the current tray icon registration state when updating its icon, so a hidden TrayIcon remains hidden until SetIsVisible(true) is called. (#22125)

pull/22130/head
Lin 4 weeks ago
committed by GitHub
parent
commit
76ff633d7c
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      src/Windows/Avalonia.Win32/TrayIconImpl.cs

6
src/Windows/Avalonia.Win32/TrayIconImpl.cs

@ -94,7 +94,7 @@ namespace Avalonia.Win32
{ {
_iconImpl = (IconImpl?)icon; _iconImpl = (IconImpl?)icon;
_iconStale = true; _iconStale = true;
UpdateIcon(); UpdateIcon(!_iconAdded);
} }
/// <inheritdoc /> /// <inheritdoc />
@ -376,6 +376,10 @@ namespace Avalonia.Win32
if (!_disposedValue) if (!_disposedValue)
{ {
UpdateIcon(true); UpdateIcon(true);
s_trayIcons.Remove(_uniqueId);
_icon?.Dispose();
_icon = null;
_disposedValue = true; _disposedValue = true;
} }

Loading…
Cancel
Save