diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c index eba3497f6..86255d5aa 100644 --- a/hw/xwin/winmultiwindowwindow.c +++ b/hw/xwin/winmultiwindowwindow.c @@ -620,8 +620,6 @@ winDestroyWindowsWindow (WindowPtr pWin) if (pWinPriv->hWnd == NULL) return; - SetProp (pWinPriv->hWnd, WIN_WINDOW_PROP, 0); - /* Store the info we need to destroy after this window is gone */ hInstance = (HINSTANCE) GetClassLong (pWinPriv->hWnd, GCL_HMODULE); hiconClass = (HICON) GetClassLong (pWinPriv->hWnd, GCL_HICON); diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c index 8c64ddbe7..3a418a472 100755 --- a/hw/xwin/winmultiwindowwndproc.c +++ b/hw/xwin/winmultiwindowwndproc.c @@ -799,6 +799,10 @@ winTopLevelWindowProc (HWND hwnd, UINT message, winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg); } + RemoveProp (hwnd, WIN_WINDOW_PROP); + RemoveProp (hwnd, WIN_WID_PROP); + RemoveProp (hwnd, WIN_NEEDMANAGE_PROP); + #if CYGMULTIWINDOW_DEBUG ErrorF ("winTopLevelWindowProc - WM_DESTROY\n"); #endif diff --git a/hw/xwin/winwin32rootless.c b/hw/xwin/winwin32rootless.c index 53c3d8479..69f2e7592 100755 --- a/hw/xwin/winwin32rootless.c +++ b/hw/xwin/winwin32rootless.c @@ -241,6 +241,7 @@ winMWExtWMCreateFrame (RootlessWindowPtr pFrame, ScreenPtr pScreen, pRLWinPriv->hbmpShadow = NULL; pRLWinPriv->hdcShadow = NULL; pRLWinPriv->hdcScreen = NULL; + pRLWinPriv->pbmihShadow = NULL; pRLWinPriv->fResized = TRUE; pRLWinPriv->fClose = FALSE; pRLWinPriv->fRestackingNow = FALSE; @@ -377,6 +378,11 @@ void winMWExtWMDestroyFrame (RootlessFrameID wid) { win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid; + HICON hiconClass; + HMODULE hInstance; + int iReturn; + char pszClass[CLASS_NAME_LENGTH]; + #if CYGMULTIWINDOW_DEBUG ErrorF ("winMWExtWMDestroyFrame (%08x) %08x\n", (int) pRLWinPriv, (int) pRLWinPriv->hWnd); @@ -401,11 +407,40 @@ winMWExtWMDestroyFrame (RootlessFrameID wid) #endif #endif + /* Store the info we need to destroy after this window is gone */ + hInstance = (HINSTANCE) GetClassLong (pRLWinPriv->hWnd, GCL_HMODULE); + hiconClass = (HICON) GetClassLong (pRLWinPriv->hWnd, GCL_HICON); + iReturn = GetClassName (pRLWinPriv->hWnd, pszClass, 512); + pRLWinPriv->fClose = TRUE; pRLWinPriv->fDestroyed = TRUE; + /* Destroy the Windows window */ DestroyWindow (pRLWinPriv->hWnd); + /* Only if we were able to get the name */ + if (iReturn) + { +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winDestroyWindowsWindow - Unregistering %s: ", pszClass); +#endif + iReturn = UnregisterClass (pszClass, hInstance); + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winDestroyWindowsWindow - %d Deleting Icon: ", iReturn); +#endif + + /* Only delete if it's not the default */ + if (hiconClass != g_hiconX && + !winIconIsOverride((unsigned long)hiconClass)) + { + iReturn = DestroyIcon (hiconClass); +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winDestroyWindowsWindow - %d\n", iReturn); +#endif + } + } + #if CYGMULTIWINDOW_DEBUG ErrorF ("winMWExtWMDestroyFrame - done\n"); #endif @@ -779,7 +814,7 @@ winMWExtWMStartDrawing (RootlessFrameID wid, char **pixelData, int *bytesPerRow) } else { - ErrorF ("winMWExtWMStartDrawing - Already window was destoroyed \n"); + ErrorF ("winMWExtWMStartDrawing - Already window was destroyed \n"); } #if CYGMULTIWINDOW_DEBUG ErrorF ("winMWExtWMStartDrawing - done (0x08x) 0x%08x %d\n", diff --git a/hw/xwin/winwin32rootlesswndproc.c b/hw/xwin/winwin32rootlesswndproc.c index 565adbe57..5bd6f90b5 100755 --- a/hw/xwin/winwin32rootlesswndproc.c +++ b/hw/xwin/winwin32rootlesswndproc.c @@ -479,11 +479,15 @@ winMWExtWMWindowProc (HWND hwnd, UINT message, /* Free the screen DC */ ReleaseDC (pRLWinPriv->hWnd, pRLWinPriv->hdcScreen); pRLWinPriv->hdcScreen = NULL; + + /* Free shadow buffer info header */ + free (pRLWinPriv->pbmihShadow); + pRLWinPriv->pbmihShadow = NULL; pRLWinPriv->fResized = FALSE; pRLWinPriv->pfb = NULL; free (pRLWinPriv); - SetProp (hwnd, WIN_WINDOW_PROP, (HANDLE)NULL); + RemoveProp (hwnd, WIN_WINDOW_PROP); break; case WM_MOUSEMOVE: