GLX: Use an assert to check for mismatched handle-to-vendor mappings.

In AddVendorPointerMapping and AddVendorXIDMapping, if there is an existing
mapping, then add an assert that the new vendor library matches the old one.

Handles have to map to at most one vendor, so if we get two different vendors
then there's a bug either in libGLX or in the vendor libraries.
This commit is contained in:
Kyle Brenneman 2016-01-06 10:23:32 -07:00
parent 6d8d0efb3f
commit c254ef4ada

View file

@ -876,7 +876,10 @@ static void AddVendorPointerMapping(__GLXvendorPointerHashtable *table,
pEntry->vendor = vendor;
HASH_ADD_PTR(_LH(*table), ptr, pEntry);
} else {
pEntry->vendor = vendor;
// Any GLXContext or GLXFBConfig handles must be unique to a single
// vendor at a time. If we get two different vendors, then there's
// either a bug in libGLX or in at least one of the vendor libraries.
assert(pEntry->vendor == vendor);
}
LKDHASH_UNLOCK(__glXPthreadFuncs, *table);
@ -1008,7 +1011,9 @@ static void AddVendorXIDMapping(Display *dpy, __GLXdisplayInfo *dpyInfo, XID xid
pEntry->vendor = vendor;
HASH_ADD(hh, _LH(dpyInfo->xidVendorHash), xid, sizeof(xid), pEntry);
} else {
pEntry->vendor = vendor;
// Like GLXContext and GLXFBConfig handles, any GLXDrawables must map
// to a single vendor library.
assert(pEntry->vendor == vendor);
}
LKDHASH_UNLOCK(__glXPthreadFuncs, dpyInfo->xidVendorHash);