nouveau: fix potential crash
authorBen Skeggs <skeggsb@gmail.com>
Sun, 2 Mar 2008 05:35:47 +0000 (16:35 +1100)
committerBen Skeggs <skeggsb@gmail.com>
Sun, 2 Mar 2008 05:35:47 +0000 (16:35 +1100)
src/gallium/winsys/dri/nouveau/nouveau_context.c

index dc852c9f49807f93b34750c197d00caefc352ac6..2e54729aa973d649525a8957f9e53d78b21185c6 100644 (file)
@@ -256,8 +256,10 @@ nouveau_context_destroy(__DRIcontextPrivate *driContextPriv)
 
        if (nv->pctx_id >= 0) {
                nvc->pctx[nv->pctx_id] = NULL;
-               if (--nvc->refcount <= 0)
+               if (--nvc->refcount <= 0) {
                        nouveau_channel_context_destroy(nvc);
+                       nv->nv_screen->nvc = NULL;
+               }
        }
 
        free(nv);