[Mesa-dev] [PATCH 08/13] glx: Generate BadContext when None is passed to glXImportContextEXT
Ian Romanick
idr at freedesktop.org
Fri Dec 16 11:55:45 PST 2011
From: Ian Romanick <ian.d.romanick at intel.com>
Fixes the piglit test glx-import-context-single-process
NOTE: This is a candidate for the 7.11 branch, but it also requires
the previous patch.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/glx/glxcmds.c | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index e4d0b12..51a76fa 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -37,12 +37,12 @@
#include "glapi.h"
#include "glxextensions.h"
#include "indirect.h"
+#include "glx_error.h"
#ifdef GLX_DIRECT_RENDERING
#ifdef GLX_USE_APPLEGL
#include "apple_glx_context.h"
#include "apple_glx.h"
-#include "glx_error.h"
#else
#include <sys/time.h>
#ifdef XF86VIDMODE
@@ -1424,7 +1424,23 @@ glXImportContextEXT(Display *dpy, GLXContextID contextID)
uint32_t screen;
Bool got_screen = False;
- if (contextID == None || __glXIsDirect(dpy, contextID))
+ /* The GLX_EXT_import_context spec says:
+ *
+ * "If <contextID> does not refer to a valid context, then a BadContext
+ * error is generated; if <contextID> refers to direct rendering
+ * context then no error is generated but glXImportContextEXT returns
+ * NULL."
+ *
+ * If contextID is None, generate BadContext on the client-side. Other
+ * sorts of invalid contexts will be detected by the server in the
+ * __glXIsDirect call.
+ */
+ if (contextID == None) {
+ __glXSendError(dpy, GLXBadContext, contextID, X_GLXIsDirect, false);
+ return NULL;
+ }
+
+ if (__glXIsDirect(dpy, contextID))
return NULL;
opcode = __glXSetupForCommand(dpy);
--
1.7.6.4
More information about the mesa-dev
mailing list