dib.c problem, and Solution to winmm deadlocking problem

Robert Lunnon bobl at optushome.com.au
Sat Apr 9 18:36:56 CDT 2005


After weeks of searching I have finally found my deadlock problem. 
Its actually not related to audio at all it's a ddraw problem with poor error handling, the surface wasn't released properly when  the error
 "Application gave us bad source rectangle for Blt." occurs

Also the 
DIB_DirectDrawSurface_Blt fuction doesn't return error status captured during execution properly, preferring to return DD_OK all the time. I propose the following patch
================================cut here===========================


Index: dib.c
===================================================================
RCS file: /home/wine/wine/dlls/ddraw/dsurface/dib.c,v
retrieving revision 1.48
diff -u -3 -p -r1.48 dib.c
--- dib.c	24 Mar 2005 21:01:39 -0000	1.48
+++ dib.c	9 Apr 2005 23:17:43 -0000
@@ -581,7 +581,8 @@ DIB_DirectDrawSurface_Blt(LPDIRECTDRAWSU
 	 (xsrc.right > sdesc.dwWidth) || (xsrc.right < 0) ||
 	 (xsrc.right < xsrc.left) || (xsrc.bottom < xsrc.top))) {
         WARN("Application gave us bad source rectangle for Blt.\n");
-	return DDERR_INVALIDRECT;
+	ret = DDERR_INVALIDRECT;
+	goto release;
     }
     /* For the Destination rect, it can be out of bounds on the condition that a clipper
        is set for the given surface.
@@ -593,7 +594,8 @@ DIB_DirectDrawSurface_Blt(LPDIRECTDRAWSU
 	 (xdst.right > ddesc.dwWidth) || (xdst.right < 0) ||
 	 (xdst.right < xdst.left) || (xdst.bottom < xdst.top))) {
         WARN("Application gave us bad destination rectangle for Blt without a clipper set.\n");
-	return DDERR_INVALIDRECT;
+	ret = DDERR_INVALIDRECT;
+	goto release;
     }
     
     /* Now handle negative values in the rectangles. Warning: only supported for now
@@ -959,7 +961,7 @@ error:
 release:
     IDirectDrawSurface7_Unlock(iface,NULL);
     if (src) IDirectDrawSurface7_Unlock(src,NULL);
-    return DD_OK;
+    return ret;
 }
 
 /* BltBatch: generic, unimplemented */



More information about the wine-devel mailing list