changeset 38416:dd0b515bc286

8155001: SystemTray.remove() leaks GDI Objects in Windows Reviewed-by: serb, alexp
author dmarkov
date Fri, 13 May 2016 12:44:53 +0300
parents acea5f7d354b
children 07152c7004b0 aabcf4406038
files jdk/src/java.desktop/windows/native/libawt/windows/awt_TrayIcon.cpp
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_TrayIcon.cpp	Fri May 13 11:31:05 2016 +0300
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_TrayIcon.cpp	Fri May 13 12:44:53 2016 +0300
@@ -93,6 +93,12 @@
 
 void AwtTrayIcon::Dispose() {
     SendTrayMessage(NIM_DELETE);
+
+    // Destroy the icon to avoid leak of GDI objects
+    if (m_nid.hIcon != NULL) {
+        ::DestroyIcon(m_nid.hIcon);
+    }
+
     UnlinkObjects();
 
     if (--sm_instCount == 0) {