GDI32: Fix for PlayEnhMetaFileRecord support of EMR_SELECTPALETTE record

Jean-Philippe_Theriault at cimmetry.com Jean-Philippe_Theriault at cimmetry.com
Tue Apr 11 09:51:15 CDT 2006





We have encountered an issue when rendering multiple EMFs to the same DC
when one of the EMFs contains a sequence of :
- EMR_CREATEPALETTE
- EMR_SELECTPALETTE
- EMR_DELETEOBJECT on the handle of the palette

The current Wine implementation for EMR_SELECTPALETTE overwrites the
handletable->objectHandle entry with the return value of SelectPalette().
This means that when we later call EMR_DELETEOBJECT, we delete the wrong
palette. When rendering subsequent EMFs this resulted in an inconsistant
state, where the palette handle selected by the DC did not have
an associated object in memory due to it having been deleted.

This is the patch we used to fix the issue:

Index: wine/dlls/gdi/enhmetafile.c
===================================================================
RCS file: /home/wine/wine/dlls/gdi/enhmetafile.c,v
retrieving revision 1.19
diff -u -p -r1.19 enhmetafile.c
--- wine/dlls/gdi/enhmetafile.c     7 Apr 2006 18:31:22 -0000     1.19
+++ wine/dlls/gdi/enhmetafile.c     11 Apr 2006 14:30:25 -0000
@@ -1162,7 +1162,6 @@ BOOL WINAPI PlayEnhMetaFileRecord(
      if( lpSelectPal->ihPal & 0x80000000 ) {
            SelectPalette( hdc, GetStockObject(lpSelectPal->ihPal &
0x7fffffff), TRUE);
      } else {
-     (handletable->objectHandle)[ lpSelectPal->ihPal ] =
            SelectPalette( hdc,
(handletable->objectHandle)[lpSelectPal->ihPal], TRUE);
      }
      break;




More information about the wine-patches mailing list