From f534bbc773e8faf6c152515b8084fe023f408706 Mon Sep 17 00:00:00 2001 From: Philipp Sumi Date: Sat, 16 Nov 2013 19:55:51 +0000 Subject: [PATCH] CHG NotifyIcon is not only removed on user-initiated disposal, but also garbage collection (NTFY-5). git-svn-id: https://svn.evolvesoftware.ch/repos/evolve.net/WPF/NotifyIcon@174 9f600761-6f11-4665-b6dc-0185e9171623 --- Source/NotifyIconWpf/Interop/WindowMessageSink.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/NotifyIconWpf/Interop/WindowMessageSink.cs b/Source/NotifyIconWpf/Interop/WindowMessageSink.cs index 42fd3a9..4aabdef 100644 --- a/Source/NotifyIconWpf/Interop/WindowMessageSink.cs +++ b/Source/NotifyIconWpf/Interop/WindowMessageSink.cs @@ -361,9 +361,10 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop private void Dispose(bool disposing) { //don't do anything if the component is already disposed - if (IsDisposed || !disposing) return; + if (IsDisposed) return; IsDisposed = true; + //always destroy the unmanaged handle (even if called from the GC) WinApi.DestroyWindow(MessageWindowHandle); messageHandler = null; }