CVS: winex/objects bitmap.c, 1.5, 1.6 dib.c, 1.11, 1.12
[email protected] 30 Mar 2007 19:01:07 -0000
Newsgroups
gmane.comp.emulators.winex.cvs
Message-ID
<[email protected] >
Subject: winex/objects bitmap.c,1.5,1.6 dib.c,1.11,1.12Update of /var/lib/cvsd/cvsroot/winex/objects
In directory agravaine:/tmp/cvs-serv7076/objects
Modified Files:
bitmap.c dib.c
Log Message:
- better separate dibsection freeing
- fix cases of double or incorrect freeing
Index: bitmap.c
===================================================================
RCS file: /var/lib/cvsd/cvsroot/winex/objects/bitmap.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- bitmap.c 27 Mar 2007 22:25:25 -0000 1.5
+++ bitmap.c 30 Mar 2007 19:01:05 -0000 1.6
@@ -143,6 +143,7 @@
bmp->physBitmap = NULL;
bmp->dib = NULL;
bmp->segptr_bits = 0;
+ bmp->gdi_owned_bitmap_bits = FALSE;
if (bits) /* Set bitmap bits */
SetBitmapBits( hbitmap, height * bmp->bitmap.bmWidthBytes,
@@ -358,7 +359,10 @@
} else {
if(!bmp->bitmap.bmBits) /* Alloc enough for entire bitmap */
- bmp->bitmap.bmBits = HeapAlloc( GetProcessHeap(), 0, count );
+ {
+ bmp->bitmap.bmBits = HeapAlloc( GetProcessHeap(), 0, count );
+ bmp->gdi_owned_bitmap_bits = TRUE;
+ }
if(!bmp->bitmap.bmBits) {
WARN("Unable to allocate bit buffer\n");
ret = 0;
@@ -407,9 +411,12 @@
{
if (bmp->funcs && bmp->funcs->pDeleteObject)
bmp->funcs->pDeleteObject( hbitmap );
-
- if( bmp->bitmap.bmBits )
+
+ if( bmp->bitmap.bmBits && bmp->gdi_owned_bitmap_bits)
+ {
HeapFree( GetProcessHeap(), 0, bmp->bitmap.bmBits );
+ bmp->bitmap.bmBits = NULL;
+ }
DIB_DeleteDIBSection( bmp );
Index: dib.c
===================================================================
RCS file: /var/lib/cvsd/cvsroot/winex/objects/dib.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- dib.c 30 Mar 2007 15:49:52 -0000 1.11
+++ dib.c 30 Mar 2007 19:01:05 -0000 1.12
@@ -975,26 +975,9 @@
{
if (bmp && bmp->dib)
{
- DIBSECTIONOBJ *dib = bmp->dib;
-
- if (dib->dsBm.bmBits)
- {
- if (dib->dshSection)
- {
- SYSTEM_INFO SystemInfo;
- GetSystemInfo( &SystemInfo );
- UnmapViewOfFile( (char *)dib->dsBm.bmBits -
- (dib->dsOffset % SystemInfo.dwAllocationGranularity) );
- }
- else if (!dib->dsOffset)
- VirtualFree(dib->dsBm.bmBits, 0L, MEM_RELEASE );
- }
-
- BITMAP_Driver->pDeleteDIBSection(bmp);
+ BITMAP_Driver->pDeleteDIBSection(bmp);
- HeapFree(GetProcessHeap(), 0, dib);
- bmp->dib = NULL;
- if (bmp->segptr_bits) SELECTOR_FreeBlock( SELECTOROF(bmp->segptr_bits) );
+ if (bmp->segptr_bits) SELECTOR_FreeBlock( SELECTOROF(bmp->segptr_bits) );
}
}