summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2013-08-08 18:17:24 -0700
committerIan Romanick <[email protected]>2013-08-13 17:53:33 -0700
commitd5aee174b88878e6d47dc1fadd3935f535fd85f0 (patch)
treedf68fa0090ef6204eb7847633a44269e9d2ad740 /src
parentef83bd2b9581c680439a5d22979c2f1b49b2834d (diff)
glx: Generate GLXBadDrawable when drawable is zero
Fixes piglit glx-query-drawable-GLXBadDrawable. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Chad Versace <[email protected]> Cc: "9.2" <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/glx/glx_pbuffer.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
index f11305a41df..183fbaaa500 100644
--- a/src/glx/glx_pbuffer.c
+++ b/src/glx/glx_pbuffer.c
@@ -40,9 +40,10 @@
#ifdef GLX_USE_APPLEGL
#include <pthread.h>
#include "apple_glx_drawable.h"
-#include "glx_error.h"
#endif
+#include "glx_error.h"
+
#define WARN_ONCE_GLX_1_3(a, b) { \
static int warned=1; \
if(warned) { \
@@ -279,7 +280,16 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
unsigned int num_attributes;
GLboolean use_glx_1_3;
- if ((dpy == NULL) || (drawable == 0)) {
+ if (dpy == NULL)
+ return 0;
+
+ /* Page 38 (page 52 of the PDF) of glxencode1.3.pdf says:
+ *
+ * "If drawable is not a valid GLX drawable, a GLXBadDrawable error is
+ * generated."
+ */
+ if (drawable == 0) {
+ __glXSendError(dpy, GLXBadDrawable, 0, X_GLXGetDrawableAttributes, false);
return 0;
}