CVS: winex/graphics/x11drv dib.c,1.99,1.100

[email protected]
Newsgroups gmane.comp.emulators.winex.cvs
Message-ID <[email protected]>
Subject: winex/graphics/x11drv dib.c,1.99,1.100Update of /var/lib/cvsd/cvsroot/winex/graphics/x11drv
In directory agravaine:/tmp/cvs-serv7009/graphics/x11drv

Modified Files:
	dib.c 
Log Message:

- better separate dibsection freeing
- fix cases of double or incorrect freeing



Index: dib.c
===================================================================
RCS file: /var/lib/cvsd/cvsroot/winex/graphics/x11drv/dib.c,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -d -r1.99 -r1.100
--- dib.c	30 Mar 2007 19:00:27 -0000	1.99
+++ dib.c	30 Mar 2007 19:00:38 -0000	1.100
@@ -6543,6 +6543,19 @@
 {
   X11DRV_DIBSECTION *dib = (X11DRV_DIBSECTION *) bmp->dib;
 
+  if (dib->dibSection.dsBm.bmBits)
+  {
+     if (dib->dibSection.dshSection)
+     {
+        SYSTEM_INFO SystemInfo;
+        GetSystemInfo( &SystemInfo );
+        UnmapViewOfFile( (char *)dib->dibSection.dsBm.bmBits -
+                         (dib->dibSection.dsOffset % SystemInfo.dwAllocationGranularity) );
+     }
+     else if (!dib->dibSection.dsOffset)
+        VirtualFree(dib->dibSection.dsBm.bmBits, 0L, MEM_RELEASE );
+  }
+
   wine_tsx11_lock();
 
   if (dib->image)
@@ -6594,6 +6607,9 @@
     HeapFree(GetProcessHeap(), 0, dib->colorMap);
 
   DeleteCriticalSection(&(dib->lock));
+ 
+  HeapFree(GetProcessHeap(), 0, dib);
+  bmp->dib = NULL;
 }
 
 /***********************************************************************
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.