gallium/targets/d3dadapter9: Release the pipe_screen at destruction.
authorAxel Davy <axel.davy@ens.fr>
Sun, 11 Jan 2015 16:51:59 +0000 (17:51 +0100)
committerAxel Davy <axel.davy@ens.fr>
Thu, 5 Feb 2015 23:07:19 +0000 (00:07 +0100)
We weren't releasing hal and ref, causing some issues (threads not released, etc)

Reviewed-by: Tiziano Bacocco <tizbac2@gmail.com>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
src/gallium/targets/d3dadapter9/drm.c

index bdc402f..f054654 100644 (file)
@@ -79,14 +79,20 @@ struct d3dadapter9drm_context
 static void
 drm_destroy( struct d3dadapter9_context *ctx )
 {
+    if (ctx->ref)
+        ctx->ref->destroy(ctx->ref);
+    /* because ref is a wrapper around hal, freeing ref frees hal too. */
+    else if (ctx->hal)
+        ctx->hal->destroy(ctx->hal);
 #if !GALLIUM_STATIC_TARGETS
-    struct d3dadapter9drm_context *drm = (struct d3dadapter9drm_context *)ctx;
+    {
+        struct d3dadapter9drm_context *drm = (struct d3dadapter9drm_context *)ctx;
 
-    /* pipe_loader_sw destroys the context */
-    if (drm->swdev)
-        pipe_loader_release(&drm->swdev, 1);
-    if (drm->dev)
-        pipe_loader_release(&drm->dev, 1);
+        if (drm->swdev)
+            pipe_loader_release(&drm->swdev, 1);
+        if (drm->dev)
+            pipe_loader_release(&drm->dev, 1);
+    }
 #endif
 
     FREE(ctx);