Re: gdi32: Avoid a crash by loading AppKit before using Core Text if might use the Mac driver.
Ken Thomases <ken(a)codeweavers.com> writes:
+ /* If the Mac driver might be used, then load AppKit now before using the Core Text API. + Otherwise, AppKit crashes on Mac OS X 10.7+ because CTFontDescriptor isn't toll-free + bridged to NSCTFontDescriptor. That bridging is only set up if AppKit has been loaded + when CTFontDescriptor is first used. */ + /* @@ Wine registry key: HKCU\Software\Wine\Drivers */ + if (!RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Drivers", &hkey)) + { + char buffer[MAX_PATH]; + DWORD type, count = sizeof(buffer); + + if (!RegQueryValueExA(hkey, "Graphics", 0, &type, (LPBYTE) buffer, &count)) + { + char *name = buffer; + + usingMacDriver = FALSE; + while (name) + { + char *next = strchr(name, ','); + if (next) *next++ = 0; + + if (!strcmp(name, "mac")) + { + usingMacDriver = TRUE; + break; + } + + name = next; + } + } + + RegCloseKey(hkey); + }
That's ugly. freetype.c has no business knowing about the details of the graphics driver. -- Alexandre Julliard julliard(a)winehq.org
On Aug 2, 2013, at 4:22 AM, Alexandre Julliard wrote:
Ken Thomases <ken(a)codeweavers.com> writes:
+ /* If the Mac driver might be used, then load AppKit now before using the Core Text API. + Otherwise, AppKit crashes on Mac OS X 10.7+ because CTFontDescriptor isn't toll-free + bridged to NSCTFontDescriptor. That bridging is only set up if AppKit has been loaded + when CTFontDescriptor is first used. */ + /* @@ Wine registry key: HKCU\Software\Wine\Drivers */ + if (!RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Drivers", &hkey)) + { + char buffer[MAX_PATH]; + DWORD type, count = sizeof(buffer); + + if (!RegQueryValueExA(hkey, "Graphics", 0, &type, (LPBYTE) buffer, &count)) + { + char *name = buffer; + + usingMacDriver = FALSE; + while (name) + { + char *next = strchr(name, ','); + if (next) *next++ = 0; + + if (!strcmp(name, "mac")) + { + usingMacDriver = TRUE; + break; + } + + name = next; + } + } + + RegCloseKey(hkey); + }
That's ugly. freetype.c has no business knowing about the details of the graphics driver.
Is it acceptable to load the graphics driver at that point, by calling DRIVER_load_driver("display", …)? -Ken
Ken Thomases <ken(a)codeweavers.com> writes:
On Aug 2, 2013, at 4:22 AM, Alexandre Julliard wrote:
That's ugly. freetype.c has no business knowing about the details of the graphics driver.
Is it acceptable to load the graphics driver at that point, by calling DRIVER_load_driver("display", …)?
That code is called during dll attach, so no, that won't work right. -- Alexandre Julliard julliard(a)winehq.org
On Aug 2, 2013, at 9:19 AM, Alexandre Julliard wrote:
Ken Thomases <ken(a)codeweavers.com> writes:
On Aug 2, 2013, at 4:22 AM, Alexandre Julliard wrote:
That's ugly. freetype.c has no business knowing about the details of the graphics driver.
Is it acceptable to load the graphics driver at that point, by calling DRIVER_load_driver("display", …)?
That code is called during dll attach, so no, that won't work right.
OK. So, is it acceptable to load AppKit regardless of which graphics driver is configured? -Ken
On Aug 2, 2013, at 9:57 AM, Ken Thomases wrote:
OK. So, is it acceptable to load AppKit regardless of which graphics driver is configured?
And, if so, would you prefer that I just link gdi32 against AppKit rather than loading it dynamically? That would mean that it would be loaded even for processes which wouldn't enumerate fonts. -Ken
Ken Thomases <ken(a)codeweavers.com> writes:
On Aug 2, 2013, at 9:57 AM, Ken Thomases wrote:
OK. So, is it acceptable to load AppKit regardless of which graphics driver is configured?
And, if so, would you prefer that I just link gdi32 against AppKit rather than loading it dynamically? That would mean that it would be loaded even for processes which wouldn't enumerate fonts.
Yes, that's probably OK. -- Alexandre Julliard julliard(a)winehq.org
participants (2)
-
Alexandre Julliard -
Ken Thomases