[PATCH 1/2] glx: Preserve more errors in CreateContext

Adam Jackson ajax at redhat.com
Wed Oct 17 11:58:33 PDT 2012


The comment being deleted here is technically correct, it _should_ be
impossible to generate anything other than BadAlloc here.  But, due to a
bug in the callee, that happens not to be the case.  Let's not lose
information without good reason.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 glx/glxcmds.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index c1f4e22..a32ceee 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -277,17 +277,15 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
      ** Allocate memory for the new context
      */
     if (!isDirect) {
-        /* Without any attributes, the only error that the driver should be
-         * able to generate is BadAlloc.  As result, just drop the error
-         * returned from the driver on the floor.
-         */
         glxc = pGlxScreen->createContext(pGlxScreen, config, shareglxc,
                                          0, NULL, &err);
+        if (!glxc)
+            return err;
     }
-    else
+    else {
         glxc = __glXdirectContextCreate(pGlxScreen, config, shareglxc);
-    if (!glxc) {
-        return BadAlloc;
+        if (!glxc)
+            return BadAlloc;
     }
 
     /* Initialize the GLXcontext structure.
-- 
1.7.12.1



More information about the xorg-devel mailing list