Try #2 IDirectDraw_CreateSurface Failure on WINE test in dsurface.c code

Michael Karcher wine at mkarcher.dialup.fu-berlin.de
Tue Oct 14 16:50:01 CDT 2008


Am Dienstag, den 14.10.2008, 13:34 -0700 schrieb chris ahrendt:
> Yes if we need to move this off list please let me know....
> 
> Michael Karcher wrote:
> > That's why I suggested you to introduce the err2 label. The end of the
> > function should look like this:   
> Ya, Ich versteh....
Sehr gut.

> here is the first patch to fix exception 1.  I did have the patch with
> the skip but decided to try this:
> 
>       if (surface4)IDirectDrawSurface_Release(surface4);
>       if (surface3) IDirectDrawSurface_Release(surface3);
>       if (surface2) IDirectDrawSurface_Release(surface2);
>       if (surface1) IDirectDrawSurface_Release(surface1);
> 
> If I do the above I get the same exception on :  if (surface3)
> IDirectDrawSurface_Release(surface3);
That is not very surprising in AttachmentTest7 and AttachmentTest as the
local variables in these functions are *not* initialised to zero, but
contain random garbage. If you want to go that route (which will work if
done right), you must make sure that the variables always contain NULL
if they don't point to a valid interface.  PaletteTest does it correcty.

> So to fix that exception I have to do the following:
> 
>       if (FAILED(hr)) {
>         skip("failed to create surface3\n");
>         if (surface2) IDirectDrawSurface_Release(surface2);
>         if (surface1) IDirectDrawSurface_Release(surface1);
>         return;
>       }
Kind of. You still forget to reset the cooperative level and to destroy
the window. I really suggest to use the goto approach instead.

> This is for IDirectDraw_CreateSurface failure which was not caught
> before for 3. The following is for the 4th surface :
Same things apply.

> Next Exception # 2 is caused by lines at 1138 :
>       hr = IDirectDraw7_CreateSurface(dd7, &ddsd, &surface1, NULL);
>       ok(hr==DD_OK,"CreateSurface returned: %x\n",hr);
OK, this is the same as above, but this time for IDirectDraw7

> To Fix that exception I have to add the below.
> 
>       if (FAILED(hr)) {
>         skip("failed to create surface1\n");
>         return;
>       }
Yes, this fixes the crash, but leaks the IDirectDraw7 interface and
forgets to reset the cooperative level.

> After that exception I have to close the window and reopen a new one to
> continue. make test refuses to run or acts strange..
That is quite probably related because you did neither release the
IDirectDraw7 or set back the cooperative level to normal.

> So I figured the env. got hosed by the last exception.
Not really the exception, but more your return statement that skipped
the needed cleanup.

> The run 3 is the final output.
You see? No patch to the TestPalette functions was needed, just as I
suspected. Fixing the AttachmentTest functions is the right way to go,
but you really need to the cleanup (especially the cooperative level) if
you abort a test.

> The two .ok files contain nothing.
That's normal.

Regards,
  Michael Karcher

PS: From the attachments of Chris' mail, one can get the following
information: The environment we are currently talking about is Wine on
Linux, an ATI FireGL 5200 graphics board driven by the closed source
driver, and somehow broken DRM.




More information about the wine-devel mailing list