glx: Initialize glx even if there are currently no screens attached

Failure to do so causes an overvlow in glxClientCallback

Application Specific Information:
X.Org X Server 1.18.99.1 Build Date: 20160911
=================================================================
==52118==ERROR: AddressSanitizer: SEGV on unknown address 0x000102b27b80 (pc 0x000103433245 bp 0x70000de67c20 sp 0x70000de67c00 T6)
    #0 0x103433244 in __asan::asan_free(void*, __sanitizer::BufferedStackTrace*, __asan::AllocType) (libclang_rt.asan_osx_dynamic.dylib+0x3244)
    #1 0x10347aeee in wrap_free (libclang_rt.asan_osx_dynamic.dylib+0x4aeee)
    #2 0x102e6a5ed in glxClientCallback glxext.c:301
    #3 0x102b672a3 in _CallCallbacks dixutils.c:737
    #4 0x102b2f0c6 in CallCallbacks callback.h:83
    #5 0x102b5c15a in NextAvailableClient dispatch.c:3562
    #6 0x102d7060c in AllocNewConnection connection.c:777
    #7 0x102d71355 in EstablishNewConnections connection.c:863
    #8 0x102b662f0 in ProcessWorkQueue dixutils.c:523
    #9 0x102d52a7f in WaitForSomething WaitFor.c:175
    #10 0x102b204f6 in Dispatch dispatch.c:411
    #11 0x102b61e01 in dix_main main.c:301
    #12 0x10254c42a in server_thread quartzStartup.c:66
    #13 0x7fffc5f16aaa in _pthread_body (libsystem_pthread.dylib+0x3aaa)
    #14 0x7fffc5f169f6 in _pthread_start (libsystem_pthread.dylib+0x39f6)
    #15 0x7fffc5f161fc in thread_start (libsystem_pthread.dylib+0x31fc)

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 1d2293101fca46c9a68c553f1be8e815c40de69a)
This commit is contained in:
Jeremy Huddleston Sequoia 2016-09-11 02:47:00 -07:00
parent 0b58c0a526
commit fd2d91758e

View file

@ -281,24 +281,6 @@ GlxPushProvider(__GLXprovider * provider)
__glXProviderStack = provider;
}
static Bool
checkScreenVisuals(void)
{
int i, j;
for (i = 0; i < screenInfo.numScreens; i++) {
ScreenPtr screen = screenInfo.screens[i];
for (j = 0; j < screen->numVisuals; j++) {
if ((screen->visuals[j].class == TrueColor ||
screen->visuals[j].class == DirectColor) &&
screen->visuals[j].nplanes > 12)
return TRUE;
}
}
return FALSE;
}
static void
GetGLXDrawableBytes(void *value, XID id, ResourceSizePtr size)
{
@ -472,10 +454,6 @@ static Bool
xorgGlxServerPreInit(const ExtensionEntry *extEntry)
{
if (glxGeneration != serverGeneration) {
/* Mesa requires at least one True/DirectColor visual */
if (!checkScreenVisuals())
return FALSE;
__glXContextRes = CreateNewResourceType((DeleteType) ContextGone,
"GLXContext");
__glXDrawableRes = CreateNewResourceType((DeleteType) DrawableGone,