[PATCH] In DRI2Connect, check to see if DRI2 has been initialized

Keith Packard keithp at keithp.com
Thu Jun 10 07:27:58 PDT 2010


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

Signed-off-by: Keith Packard <keithp at keithp.com>
---

 hw/xfree86/dri2/dri2.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 27d8e25..a8dedfa 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -957,8 +957,12 @@ Bool
 DRI2Connect(ScreenPtr pScreen, unsigned int driverType, int *fd,
 	    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 ||
 	    !ds->driverNames[driverType])
 	return FALSE;
-- 
1.7.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20100610/4ca4040a/attachment-0001.pgp>


More information about the xorg-devel mailing list