galahad: Use reference counting when destroying the wraped objects.
authorJosé Fonseca <jfonseca@vmware.com>
Fri, 6 Jul 2012 17:31:15 +0000 (18:31 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Fri, 6 Jul 2012 17:35:44 +0000 (18:35 +0100)
As the wrapped pipe driver may hold internal references.

src/gallium/drivers/galahad/glhd_objects.c

index badd2e1c1b7586c6c1219478583119ade5878b8d..b44adff20c737e87e9257eb7feb768054a8bc766 100644 (file)
@@ -105,7 +105,7 @@ galahad_surface_destroy(struct galahad_context *glhd_context,
                          struct galahad_surface *glhd_surface)
 {
    pipe_resource_reference(&glhd_surface->base.texture, NULL);
-   glhd_context->pipe->surface_destroy(glhd_context->pipe, glhd_surface->surface);
+   pipe_surface_reference(&glhd_surface->surface, NULL);
    FREE(glhd_surface);
 }
 
@@ -140,9 +140,8 @@ void
 galahad_sampler_view_destroy(struct galahad_context *glhd_context,
                               struct galahad_sampler_view *glhd_view)
 {
+   pipe_sampler_view_reference(&glhd_view->sampler_view, NULL);
    pipe_resource_reference(&glhd_view->base.texture, NULL);
-   glhd_context->pipe->sampler_view_destroy(glhd_context->pipe,
-                                          glhd_view->sampler_view);
    FREE(glhd_view);
 }