#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) { \
XID drawable, XID glxdrawable,
const int *attrib_list, size_t num_attribs)
{
- return GL_FALSE;
+ return GL_TRUE;
}
static void
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;
}
length = reply.length;
if (length) {
num_attributes = (use_glx_1_3) ? reply.numAttribs : length / 2;
- data = (CARD32 *) Xmalloc(length * sizeof(CARD32));
+ data = malloc(length * sizeof(CARD32));
if (data == NULL) {
/* Throw data on the floor */
_XEatData(dpy, length);
}
#endif
- Xfree(data);
+ free(data);
}
}
Drawable drawable, const int *attrib_list, CARD8 glxCode)
{
xGLXCreateWindowReq *req;
+ struct glx_drawable *glxDraw;
CARD32 *data;
unsigned int i;
CARD8 opcode;
if (!opcode)
return None;
+ glxDraw = malloc(sizeof(*glxDraw));
+ if (!glxDraw)
+ return None;
+
LockDisplay(dpy);
GetReqExtra(GLXCreateWindow, 8 * i, req);
data = (CARD32 *) (req + 1);
UnlockDisplay(dpy);
SyncHandle();
+ if (InitGLXDrawable(dpy, glxDraw, drawable, xid)) {
+ free(glxDraw);
+ return None;
+ }
+
if (!CreateDRIDrawable(dpy, config, drawable, xid, attrib_list, i)) {
if (glxCode == X_GLXCreatePixmap)
glxCode = X_GLXDestroyPixmap;
protocolDestroyDrawable(dpy, drawable, glxCode);
+ DestroyGLXDrawable(dpy, drawable);
DestroyDRIDrawable(dpy, drawable, GL_FALSE);
return;
return None;
}
- XFree(visinfo);
+ free(visinfo);
return win;
#else