Author: fireball Date: Sat Aug 22 11:40:36 2009 New Revision: 42839
URL: http://svn.reactos.org/svn/reactos?rev=42839&view=rev Log: - Free brush's pattern bitmap only if it wasn't a user provided one. Fixes a lot of double-free errors.
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/brushobj.c branches/arwinss/reactos/subsystems/win32/win32k/include/brushobj.h
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/brushobj.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gre/brushobj.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gre/brushobj.c [iso-8859-1] Sat Aug 22 11:40:36 2009 @@ -218,8 +218,9 @@ pBrush = EngAllocMem(FL_ZERO_MEMORY, sizeof(BRUSHGDI), TAG_BRUSHOBJ); if (!pBrush) return NULL;
- /* Set SOLID flag */ + /* Set BITMAP and USER_BITMAP flags */ pBrush->flAttrs |= GDIBRUSH_IS_BITMAP; + pBrush->flAttrs |= GDIBRUSH_USER_BITMAP;
/* Set bitmap */ pBrush->hbmPattern = hbmPattern; @@ -269,8 +270,8 @@ NTAPI GreFreeBrush(PBRUSHGDI pBrush) { - /* Free the pattern bitmap if any */ - if (pBrush->hbmPattern) + /* Free the pattern bitmap if it wasn't user-provided */ + if (pBrush->hbmPattern && !(pBrush->flAttrs & GDIBRUSH_USER_BITMAP)) { GDIOBJ_SetOwnership(pBrush->hbmPattern, PsGetCurrentProcess()); GreDeleteBitmap(pBrush->hbmPattern);
Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/brushobj.h URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/include/brushobj.h [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/include/brushobj.h [iso-8859-1] Sat Aug 22 11:40:36 2009 @@ -18,7 +18,7 @@ #define GDIBRUSH_IS_DEFAULTSTYLE 0x4000 #define GDIBRUSH_IS_MASKING 0x8000 /* Pattern bitmap is used as transparent mask (?) */ #define GDIBRUSH_IS_INSIDEFRAME 0x00010000 -#define GDIBRUSH_CACHED_ENGINE 0x00040000 +#define GDIBRUSH_USER_BITMAP 0x00040000 /* Bitmap is not self-allocated */ #define GDIBRUSH_CACHED_IS_SOLID 0x80000000
/* Total amount of hatch brush styles */