[PATCH 07/11] glx: Initialize all context fields together

Ian Romanick idr at freedesktop.org
Fri Apr 13 18:11:49 PDT 2012


From: Ian Romanick <ian.d.romanick at intel.com>

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Jesse Barnes <jbarnes at virtuousgeek.org>
---
 glx/glxcmds.c |   26 +++++++++-----------------
 1 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index f754104..81e1b7c 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -292,26 +292,10 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
         return BadAlloc;
     }
 
-    /*
-     ** Initially, setup the part of the context that could be used by
-     ** a GL core that needs windowing information (e.g., Mesa).
+    /* Initialize the GLXcontext structure.
      */
     glxc->pGlxScreen = pGlxScreen;
     glxc->config = config;
-
-    /*
-     ** Register this context as a resource.
-     */
-    if (!AddResource(gcId, __glXContextRes, (pointer) glxc)) {
-        (*glxc->destroy) (glxc);
-        client->errorValue = gcId;
-        return BadAlloc;
-    }
-
-    /*
-     ** Finally, now that everything is working, setup the rest of the
-     ** context.
-     */
     glxc->id = gcId;
     glxc->share_id = shareList;
     glxc->idExists = GL_TRUE;
@@ -319,6 +303,14 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
     glxc->isDirect = isDirect;
     glxc->renderMode = GL_RENDER;
 
+    /* Register this context as a resource.
+     */
+    if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) {
+        (*glxc->destroy) (glxc);
+        client->errorValue = gcId;
+        return BadAlloc;
+    }
+    
     __glXAddToContextList(glxc);
 
     return Success;
-- 
1.7.6.5



More information about the xorg-devel mailing list