[xorg-commit-diffs] xc/programs/Xserver/hw/xwin winmultiwindowwindow.c, 1.1.4.1.2.23, 1.1.4.1.2.24 winmultiwindowwndproc.c, 1.1.6.15, 1.1.6.16 winwin32rootless.c, 1.1.2.8, 1.1.2.9 winwin32rootlesswndproc.c, 1.1.2.8, 1.1.2.9

Kensuke Matsuzaki xorg-commit at pdx.freedesktop.org
Sat Apr 10 16:18:12 PDT 2004


Committed by: zakki

Update of /cvs/xorg/xc/programs/Xserver/hw/xwin
In directory pdx:/tmp/cvs-serv29292

Modified Files:
      Tag: CYGWIN
	winmultiwindowwindow.c winmultiwindowwndproc.c 
	winwin32rootless.c winwin32rootlesswndproc.c 
Log Message:
Fix MWExtWM resource leak.


Index: winmultiwindowwindow.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winmultiwindowwindow.c,v
retrieving revision 1.1.4.1.2.23
retrieving revision 1.1.4.1.2.24
diff -u -d -r1.1.4.1.2.23 -r1.1.4.1.2.24
--- a/winmultiwindowwindow.c	9 Apr 2004 04:59:30 -0000	1.1.4.1.2.23
+++ b/winmultiwindowwindow.c	10 Apr 2004 23:18:09 -0000	1.1.4.1.2.24
@@ -620,8 +620,6 @@
   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);

Index: winmultiwindowwndproc.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winmultiwindowwndproc.c,v
retrieving revision 1.1.6.15
retrieving revision 1.1.6.16
diff -u -d -r1.1.6.15 -r1.1.6.16
--- a/winmultiwindowwndproc.c	3 Apr 2004 05:00:46 -0000	1.1.6.15
+++ b/winmultiwindowwndproc.c	10 Apr 2004 23:18:09 -0000	1.1.6.16
@@ -799,6 +799,10 @@
 	    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

Index: winwin32rootless.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/Attic/winwin32rootless.c,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -u -d -r1.1.2.8 -r1.1.2.9
--- a/winwin32rootless.c	3 Mar 2004 02:57:00 -0000	1.1.2.8
+++ b/winwin32rootless.c	10 Apr 2004 23:18:09 -0000	1.1.2.9
@@ -241,6 +241,7 @@
   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 @@
 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 @@
 #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 @@
     }
   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",

Index: winwin32rootlesswndproc.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/Attic/winwin32rootlesswndproc.c,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -u -d -r1.1.2.8 -r1.1.2.9
--- a/winwin32rootlesswndproc.c	9 Apr 2004 05:52:50 -0000	1.1.2.8
+++ b/winwin32rootlesswndproc.c	10 Apr 2004 23:18:09 -0000	1.1.2.9
@@ -479,11 +479,15 @@
       /* 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:




More information about the xorg-commit-diffs mailing list