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

Alexandre Julliard julliard at winehq.org
Fri Aug 2 04:22:18 CDT 2013


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.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list