Hello everybody,
I am debugging an application and got up to the point where I have reason to believe that the StretchBlt function in GDI is part of the problem. A backtrace of the exception I always run into looks like this:
err:syslevel:_CheckNotSysLevel Holding lock 0x7ecd0820 level 3 wine: Unhandled exception 0x80000003 at address 0x0000:0x7ee96b34 (thread 0011), starting debugger... WineDbg starting on pid 0x10 err:syslevel:_CheckNotSysLevel Holding lock 0x7ecd0820 level 3 0x7ee96b35 _CheckNotSysLevel+0x3d in kernel32: addl $36,%esp Wine-dbg>bt Backtrace: =>1 0x7ee96b35 _CheckNotSysLevel+0x3d in kernel32 (0x7ee96b35) 2 0x7ec84c81 GDI_CheckNotLock+0x20 in gdi32 (0x7ec84c81) 3 0x7ec628e8 DeleteDC+0x26 in gdi32 (0x7ec628e8) 4 0x7ec6420b GetDIBits+0x1fd in gdi32 (0x7ec6420b) 5 0x7ec6c282 in gdi32 (+0x2c282) (0x7ec6c282) 6 0x7ec5bfee StretchBlt+0xca in gdi32 (0x7ec5bfee) 7 0x0042a3aa in bav (+0x2a3aa) (0x0042a3aa) 8 0x00425460 in bav (+0x25460) (0x00425460) 9 0x005d1304 in bav (+0x1d1304) (0x005d1304) 10 0x005e4f5d in bav (+0x1e4f5d) (0x005e4f5d) 11 0x0066f10b in bav (+0x26f10b) (0x0066f10b) 12 0x00681f8b in bav (+0x281f8b) (0x00681f8b) 13 0x7ee7ff5f in kernel32 (+0x4ff5f) (0x7ee7ff5f) 14 0xb7e9d387 wine_switch_to_stack+0x17 in libwine.so.1 (0xb7e9d387)
When looking at StretchBlt's source code, I see a comment saying that there is a race condition in this function[1]. If I'm not mistaken, this problem has been reported in january as bug #4284, causing trouble (a deadlock) with MS PowerPoint[2]. Walt Ogburn suggested in january that commenting out #define STRETCH_VIA_DIB in dlls/gdi/mfdrv/bitblt.c could work around the problem[3].
Does anybody have any idea on how a proper fix for that function might approximately look like?
Thanks,
David
[1] http://source.winehq.org/source/dlls/gdi/bitblt.c#L139 [2] http://bugs.winehq.com/show_bug.cgi?id=4284 [3] http://www.winehq.org/pipermail/wine-devel/2006-January/044040.html