diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2010-07-22 18:36:51 +0100 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2011-04-27 14:22:13 +0100 |
commit | bd288c3458bc1ba2cbb4c8416e5b2dfd849581e6 (patch) | |
tree | a0edc2f8460cb240b9fe45996f28649a76f7a728 /hw/xwin/winmultiwindowwindow.c | |
parent | 19e764eee0c8b74d877fb2b1d6aedc933976660e (diff) |
Cygwin/X: Fix a GDI bitmap resource leak of window icons
Ensure any icon created specially for a window is destroyed when
the window is destroyed
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
Tested-by: Colin Harrison <colin.harrison@virgin.net>
Diffstat (limited to 'hw/xwin/winmultiwindowwindow.c')
-rw-r--r-- | hw/xwin/winmultiwindowwindow.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c index 7efc360a4..61305e19d 100644 --- a/hw/xwin/winmultiwindowwindow.c +++ b/hw/xwin/winmultiwindowwindow.c @@ -592,7 +592,9 @@ winDestroyWindowsWindow (WindowPtr pWin) MSG msg; winWindowPriv(pWin); BOOL oldstate = winInDestroyWindowsWindow; - + HICON hIcon; + HICON hIconSm; + #if CYGMULTIWINDOW_DEBUG ErrorF ("winDestroyWindowsWindow\n"); #endif @@ -603,13 +605,22 @@ winDestroyWindowsWindow (WindowPtr pWin) winInDestroyWindowsWindow = TRUE; + /* Store the info we need to destroy after this window is gone */ + hIcon = (HICON)SendMessage(pWinPriv->hWnd, WM_GETICON, ICON_BIG, 0); + hIconSm = (HICON)SendMessage(pWinPriv->hWnd, WM_GETICON, ICON_SMALL, 0); + SetProp (pWinPriv->hWnd, WIN_WINDOW_PROP, NULL); + /* Destroy the Windows window */ DestroyWindow (pWinPriv->hWnd); /* Null our handle to the Window so referencing it will cause an error */ pWinPriv->hWnd = NULL; + /* Destroy any icons we created for this window */ + winDestroyIcon(hIcon); + winDestroyIcon(hIconSm); + /* Process all messages on our queue */ while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) { |