In DRI2Connect, check to see if DRI2 has been initialized (bug 28424)

This prevents DRI2GetScreen from being invoked with an uninitialized
private key which would cause an assert failure.

Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: David Ronis <David.Ronis@McGill.CA>
This commit is contained in:
Keith Packard 2010-06-07 16:28:34 -07:00
parent 68a9ee8370
commit 505724c5f3

View File

@ -957,8 +957,12 @@ Bool
DRI2Connect(ScreenPtr pScreen, unsigned int driverType, int *fd, DRI2Connect(ScreenPtr pScreen, unsigned int driverType, int *fd,
const char **driverName, const char **deviceName) const char **driverName, const char **deviceName)
{ {
DRI2ScreenPtr ds = DRI2GetScreen(pScreen); DRI2ScreenPtr ds;
if (!dixPrivateKeyRegistered(dri2ScreenPrivateKey))
return FALSE;
ds = DRI2GetScreen(pScreen);
if (ds == NULL || driverType >= ds->numDrivers || if (ds == NULL || driverType >= ds->numDrivers ||
!ds->driverNames[driverType]) !ds->driverNames[driverType])
return FALSE; return FALSE;