gdi32: Avoid a crash by loading AppKit before using Core Text if might use the Mac driver.

Ken Thomases ken at codeweavers.com
Fri Aug 2 08:37:24 CDT 2013


On Aug 2, 2013, at 4:22 AM, Alexandre Julliard wrote:

> Ken Thomases <ken at 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




More information about the wine-devel mailing list