#if defined(GLX_DIRECT_RENDERING) || defined(GLX_USE_APPLEGL)
struct glx_screen *const psc = GetGLXScreenConfigs(dpy, vis->screen);
- config = glx_config_find_visual(psc->visuals, vis->visualid);
+ if (psc)
+ config = glx_config_find_visual(psc->visuals, vis->visualid);
+
if (config == NULL) {
xError error;
GLXPixmap xid;
CARD8 opcode;
+#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
+ struct glx_display *const priv = __glXInitialize(dpy);
+
+ if (priv == NULL)
+ return None;
+#endif
+
opcode = __glXSetupForCommand(dpy);
if (!opcode) {
return None;
/* FIXME: Maybe delay __DRIdrawable creation until the drawable
* is actually bound to a context... */
- struct glx_display *const priv = __glXInitialize(dpy);
__GLXDRIdrawable *pdraw;
struct glx_screen *psc;
struct glx_config *config;
struct glx_display *const priv = __glXInitialize(dpy);
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, glxpixmap);
- if (pdraw != NULL) {
+ if (priv != NULL && pdraw != NULL) {
(*pdraw->destroyDrawable) (pdraw);
__glxHashDelete(priv->drawHash, glxpixmap);
}
uint32_t screen = 0;
Bool got_screen = False;
+ if (priv == NULL)
+ return NULL;
+
/* The GLX_EXT_import_context spec says:
*
* "If <contextID> does not refer to a valid context, then a BadContext
psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen);
#ifdef GLX_DIRECT_RENDERING
- if (gc->isDirect && psc->driScreen && psc->driScreen->setSwapInterval) {
+ if (gc->isDirect && psc && psc->driScreen &&
+ psc->driScreen->setSwapInterval) {
__GLXDRIdrawable *pdraw =
GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable);
psc->driScreen->setSwapInterval(pdraw, interval);
struct glx_screen *psc;
psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen);
- if (psc->driScreen && psc->driScreen->setSwapInterval) {
+ if (psc && psc->driScreen && psc->driScreen->setSwapInterval) {
__GLXDRIdrawable *pdraw =
GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable);
return psc->driScreen->setSwapInterval(pdraw, interval);
struct glx_screen *psc;
psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen);
- if (psc->driScreen && psc->driScreen->getSwapInterval) {
+ if (psc && psc->driScreen && psc->driScreen->getSwapInterval) {
__GLXDRIdrawable *pdraw =
GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable);
return psc->driScreen->getSwapInterval(pdraw);
* FIXME: documentation for the GLX encoding.
*/
#ifdef GLX_DIRECT_RENDERING
- if (psc->driScreen && psc->driScreen->getDrawableMSC) {
+ if (psc && psc->driScreen && psc->driScreen->getDrawableMSC) {
ret = psc->driScreen->getDrawableMSC(psc, pdraw, &ust, &msc, &sbc);
*count = (unsigned) msc;
return (ret == True) ? 0 : GLX_BAD_CONTEXT;
#endif
#ifdef GLX_DIRECT_RENDERING
- if (psc->driScreen && psc->driScreen->waitForMSC) {
+ if (psc && psc->driScreen && psc->driScreen->waitForMSC) {
ret = psc->driScreen->waitForMSC(pdraw, 0, divisor, remainder, &ust, &msc,
&sbc);
*count = (unsigned) msc;