8155001: SystemTray.remove() leaks GDI Objects in Windows
Reviewed-by: serb, alexp
--- 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) {