vbo: fix crash found with shared display lists
authorBrian Paul <brianp@vmware.com>
Wed, 6 Mar 2013 19:08:17 +0000 (12:08 -0700)
committerBrian Paul <brianp@vmware.com>
Thu, 7 Mar 2013 13:28:23 +0000 (06:28 -0700)
This fixes a crash when a display list is created in one context
but executed from a second one.  The vbo_save_context::vertex_store
memeber will be NULL if we never created a display list with the
context.  Just check for that before dereferencing the pointer.

Fixes http://bugzilla.redhat.com/show_bug.cgi?id=918661

Note: This is a candidate for the stable branches.

src/mesa/vbo/vbo_save_draw.c

index efb386e..f5b5c41 100644 (file)
@@ -253,7 +253,7 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, void *data)
    struct vbo_save_context *save = &vbo_context(ctx)->save;
    GLboolean remap_vertex_store = GL_FALSE;
 
-   if (save->vertex_store->buffer) {
+   if (save->vertex_store && save->vertex_store->buffer) {
       /* The vertex store is currently mapped but we're about to replay
        * a display list.  This can happen when a nested display list is
        * being build with GL_COMPILE_AND_EXECUTE.