vl: Dec sampler view refs instead of destroying them.
authorYounes Manton <younes.m@gmail.com>
Mon, 24 May 2010 17:44:06 +0000 (13:44 -0400)
committerYounes Manton <younes.m@gmail.com>
Mon, 24 May 2010 17:44:06 +0000 (13:44 -0400)
Gets rid of a bunch of double frees and the crash at shutdown.

src/gallium/auxiliary/vl/vl_compositor.c
src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c

index b128af19ba351693c25694f3ad70c15a344dc7fd..8203bf79ee0b7905d6fbcfc6e5634ed6085a13ec 100644 (file)
@@ -258,14 +258,14 @@ texview_map_delete(const struct keymap *map,
                    const void *key, void *data,
                    void *user)
 {
-   struct pipe_context *pipe = (struct pipe_context*)user;
+   struct pipe_sampler_view *sv = (struct pipe_sampler_view*)data;
 
    assert(map);
    assert(key);
    assert(data);
    assert(user);
 
-   pipe->sampler_view_destroy(pipe, data);
+   pipe_sampler_view_reference(&sv, NULL);
 }
 
 bool vl_compositor_init(struct vl_compositor *compositor, struct pipe_context *pipe)
@@ -506,7 +506,7 @@ static void draw_layers(struct vl_compositor *c,
       c->pipe->draw_arrays(c->pipe, PIPE_PRIM_TRIANGLES, i * 6, 6);
 
       if (delete_view) {
-         c->pipe->sampler_view_destroy(c->pipe, surface_view);
+         pipe_sampler_view_reference(&surface_view, NULL);
       }
    }
 }
index 1e9a02c270dc7fed7f1f8adbcf2c239086c54020..bafe4861fa501865104b425cd417e69353373558 100644 (file)
@@ -675,7 +675,7 @@ cleanup_buffers(struct vl_mpeg12_mc_renderer *r)
    pipe_resource_reference(&r->vs_const_buf, NULL);
 
    for (i = 0; i < 3; ++i) {
-      r->pipe->sampler_view_destroy(r->pipe, r->sampler_views.all[i]);
+      pipe_sampler_view_reference(&r->sampler_views.all[i], NULL);
       r->pipe->delete_vertex_elements_state(r->pipe, r->vertex_elems_state.all[i]);
       pipe_resource_reference(&r->vertex_bufs.all[i].buffer, NULL);
       pipe_resource_reference(&r->textures.all[i], NULL);
@@ -1311,14 +1311,14 @@ texview_map_delete(const struct keymap *map,
                    const void *key, void *data,
                    void *user)
 {
-   struct pipe_context *pipe = (struct pipe_context*)user;
+   struct pipe_sampler_view *sv = (struct pipe_sampler_view*)data;
 
    assert(map);
    assert(key);
    assert(data);
    assert(user);
 
-   pipe->sampler_view_destroy(pipe, data);
+   pipe_sampler_view_reference(&sv, NULL);
 }
 
 bool