egl/dri: Don't invoke dri2_dpy->flush if it's NULL.
authorJosé Fonseca <jfonseca@vmware.com>
Tue, 5 Feb 2013 13:43:01 +0000 (13:43 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Wed, 6 Feb 2013 09:22:26 +0000 (09:22 +0000)
I'd like to test Mesa OpenGL ES along side with NVIDIA libGL drivers. But
without this change, I get a NULL pointer dereference.

Reviewed-by: Brian Paul <brianp@vmware.com>
src/egl/drivers/dri2/egl_dri2.c

index 0ffbc68649c157aa60ffc18bb2cf0534b456b9ba..ae842d7a1bb5a7f9bd63943495bb6b36959de8c3 100644 (file)
@@ -976,7 +976,8 @@ dri2_wait_client(_EGLDriver *drv, _EGLDisplay *disp, _EGLContext *ctx)
    /* FIXME: If EGL allows frontbuffer rendering for window surfaces,
     * we need to copy fake to real here.*/
 
-   (*dri2_dpy->flush->flush)(dri2_surf->dri_drawable);
+   if (dri2_dpy->flush != NULL)
+      dri2_dpy->flush->flush(dri2_surf->dri_drawable);
 
    return EGL_TRUE;
 }