gdi32: Don't hold the GDI lock while calling WineEngCreateFontInstance().

Liu Qishuai lqs.buaa at gmail.com
Thu Jul 3 04:57:13 CDT 2008


Hi,
If I set FontLink in registry, Picasa may hang on startup.


lqs at lqs-desktop:~/.wine/drive_c/Program Files/Picasa2$ wine Picasa2
fixme:ntoskrnl:KeInitializeSpinLock 0x457a04
fixme:ole:CoResumeClassObjects stub
fixme:wininet:InternetGetConnectedState always returning LAN connection.
fixme:urlmon:ObtainUserAgentString (0, 0x33d27f, 0x33d278): stub
fixme:urlmon:ObtainUserAgentString (0, 0x130150, 0x33d278): stub
fixme:wininet:InternetLockRequestFile STUB
err:ntdll:RtlpWaitForCriticalSection section 0x7ea04100 "freetype.c:
freetype_cs" wait timed out in thread 0022, blocked by 0009, retrying
(60 sec)
err:ntdll:RtlpWaitForCriticalSection section 0x7ea041a0 "gdiobj.c:
GDI_level" wait timed out in thread 0009, blocked by 0022, retrying
(60 sec)



lqs at lqs-desktop:~$ winedbg
Wine-dbg>attach 8
RtlpWaitForCriticalSection () at /home/lqs/w/wine/dlls/ntdll/critsection.c:64
0x7ef8e98f RtlpWaitForCriticalSection+0x10f
[/home/lqs/w/wine/dlls/ntdll/critsection.c:64] in ntdll:
xchgl	%edi,%ebx
64	    __asm__ __volatile__( "xchgl %2,%%ebx\n\t"
Wine-dbg>bt 0x22
Backtrace:
=>1 0x7ef8e98f RtlpWaitForCriticalSection+0x10f(crit=0x7ea04100)
[/home/lqs/w/wine/dlls/ntdll/critsection.c:64] in ntdll (0x7cbb4a2c)
  2 0x7ef8eeb0 RtlEnterCriticalSection+0x50(crit=<register EDI not in
topmost frame>) [/home/lqs/w/wine/dlls/ntdll/critsection.c:553] in
ntdll (0x7cbb4a4c)
  3 0x7e9cd74b WineEngCreateFontInstance+0x2b(dc=0x18bc90, hfont=0x7c)
[/home/lqs/w/wine/dlls/gdi32/freetype.c:3247] in gdi32 (0x7cbb4c6c)
  4 0x7e9babf7 FONT_SelectObject+0x127(handle=<register ESI not in
topmost frame>, hdc=0x7f4) [/home/lqs/w/wine/dlls/gdi32/font.c:492] in
gdi32 (0x7cbb4c9c)
  5 0x7e9d2878 SelectObject+0xa8(hdc=0x7f4, hObj=<register ESI not in
topmost frame>) [/home/lqs/w/wine/dlls/gdi32/gdiobj.c:1129] in gdi32
(0x7cbb4ccc)
  6 0x7e9a91ba DC_InitDC+0x9a(dc=<register ESI not in topmost frame>)
[/home/lqs/w/wine/dlls/gdi32/dc.c:247] in gdi32 (0x7cbb4cec)
  7 0x7e9a9f68 CreateCompatibleDC+0x168(hdc=0x0)
[/home/lqs/w/wine/dlls/gdi32/dc.c:815] in gdi32 (0x7cbb4d2c)
Wine-dbg>bt 0x9
Backtrace:
=>1 0x7ef8e98f RtlpWaitForCriticalSection+0x10f(crit=0x7ea041a0)
[/home/lqs/w/wine/dlls/ntdll/critsection.c:64] in ntdll (0x00329470)
  2 0x7ef8eeb0 RtlEnterCriticalSection+0x50(crit=<register EDI not in
topmost frame>) [/home/lqs/w/wine/dlls/ntdll/critsection.c:553] in
ntdll (0x00329490)
  3 0x7ee5f7c6 _EnterSysLevel+0xb6(lock=0x7ea041a0)
[/home/lqs/w/wine/dlls/kernel32/syslevel.c:106] in kernel32
(0x003294d0)
  4 0x7e9d2be1 GDI_AllocObject+0x31(size=0x6c, magic=0x4f49,
handle=0x329580, funcs=0x7e9fb688)
[/home/lqs/w/wine/dlls/gdi32/gdiobj.c:648] in gdi32 (0x00329510)
  5 0x7e9ba847 CreateFontIndirectW+0x57(plf=<register ESI not in
topmost frame>) [/home/lqs/w/wine/dlls/gdi32/font.c:348] in gdi32
(0x00329590)
  6 0x7e9c4a69 get_glyph_index_linked+0x129(font=0x187d28, c=0x52a0,
linked_font=0x329790, glyph=0x32978c)
[/home/lqs/w/wine/dlls/gdi32/freetype.c:5293] in gdi32 (0x003295e0)
  7 0x7e9cfd92 WineEngGetGlyphOutline+0x1b2(incoming_font=0x187d28,
glyph=<register EDI not in topmost frame>, format=<is not available>,
lpgm=0x32983c, buflen=0x0, buf=0x0, lpmat=0x329824)
[/home/lqs/w/wine/dlls/gdi32/freetype.c:4313] in gdi32 (0x003297a0)
  8 0x7e9ba135 GetGlyphOutlineW+0x75(hdc=0x7d0, uChar=0x52a0,
fuFormat=0x5, lpgm=0x32983c, cbBuffer=0x0, lpBuffer=0x0,
lpmat2=0x329824) [/home/lqs/w/wine/dlls/gdi32/font.c:2364] in gdi32
(0x003297e0)
  9 0x006f6286 in picasa2 (+0x2f6286) (0x003298bc)
Wine-dbg>


Attachment is the patch.

 dlls/gdi32/font.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-gdi32-Fix-a-deadlock-that-causes-picasa-hang-if-Fon.patch
Type: text/x-diff
Size: 951 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20080703/c48c91a2/attachment.patch 


More information about the wine-patches mailing list