Small DDraw patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

While mucking around for another thing, I managed to crash Windows Media
Player in DDraw. This patch fixes it. 

It is released under the 'do whatever you want with it as long as you do not
start to discuss license merits' license. I suppose it is compatible with
the Wine license for most of the people on this list :-)

Changelog:
 - fix crash in the X11 HAL when setting a NULL palette to a surface

-- 
		 Lionel Ulmer - http://www.bbrox.org/
Index: dlls/x11drv/x11ddraw.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/x11ddraw.c,v
retrieving revision 1.12
diff -u -r1.12 x11ddraw.c
--- dlls/x11drv/x11ddraw.c	2001/08/27 19:04:18	1.12
+++ dlls/x11drv/x11ddraw.c	2002/02/23 17:01:09
@@ -159,12 +159,14 @@
 
 static DWORD PASCAL X11DRV_DDHAL_SetPalette(LPDDHAL_SETPALETTEDATA data)
 {
-  Colormap pal = data->lpDDPalette->u1.dwReserved1;
-  if (pal) {
+  if (data->lpDDPalette && data->lpDDPalette->u1.dwReserved1) {
     if (data->lpDDSurface == X11DRV_DD_Primary) {
       FIXME("stub\n");
       /* we should probably find the ddraw window (maybe data->lpDD->lpExclusiveOwner->hWnd),
-       * and attach the palette to it */
+       * and attach the palette to it
+       *
+       * Colormap pal = data->lpDDPalette->u1.dwReserved1;
+       */
     }
   }
   data->ddRVal = DD_OK;
Index: dlls/ddraw/dsurface/hal.c
===================================================================
RCS file: /home/wine/wine/dlls/ddraw/dsurface/hal.c,v
retrieving revision 1.3
diff -u -r1.3 hal.c
--- dlls/ddraw/dsurface/hal.c	2001/09/10 23:12:16	1.3
+++ dlls/ddraw/dsurface/hal.c	2002/02/23 17:01:13
@@ -223,7 +223,7 @@
     DIB_DirectDrawSurface_set_palette(This, pal);
     data.lpDD = dd_gbl;
     data.lpDDSurface = &This->local;
-    data.lpDDPalette = &pal->global;
+    data.lpDDPalette = (pal != NULL ? &pal->global : NULL);
     data.ddRVal = 0;
     data.Attach = TRUE; /* what's this? */
     data.SetPalette = dd_gbl->lpDDCBtmp->HALDDSurface.SetPalette;

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux