nv50/nvc0: fix crash when channel allocation fails
authorMarcin Slusarz <marcin.slusarz@gmail.com>
Fri, 11 Nov 2011 19:45:08 +0000 (20:45 +0100)
committerMarcin Slusarz <marcin.slusarz@gmail.com>
Fri, 2 Dec 2011 18:31:50 +0000 (19:31 +0100)
src/gallium/drivers/nv50/nv50_screen.c
src/gallium/drivers/nvc0/nvc0_screen.c

index 47eba85ba84e35b3988193b226f12ffbb9e8064c..3cd5fdfedf3e779133ccb99635001a9250e9411f 100644 (file)
@@ -228,7 +228,8 @@ nv50_screen_destroy(struct pipe_screen *pscreen)
       nouveau_fence_wait(screen->base.fence.current);
       nouveau_fence_ref (NULL, &screen->base.fence.current);
    }
-   screen->base.channel->user_private = NULL;
+   if (screen->base.channel)
+      screen->base.channel->user_private = NULL;
    if (screen->blitctx)
       FREE(screen->blitctx);
 
index 38f918ac83f127ef70c40b8eab3c181bf1826718..79c3e36b8f93890faae0971190aff81597a5eb7c 100644 (file)
@@ -220,7 +220,8 @@ nvc0_screen_destroy(struct pipe_screen *pscreen)
       nouveau_fence_wait(screen->base.fence.current);
       nouveau_fence_ref(NULL, &screen->base.fence.current);
    }
-   screen->base.channel->user_private = NULL;
+   if (screen->base.channel)
+      screen->base.channel->user_private = NULL;
 
    if (screen->blitctx)
       FREE(screen->blitctx);