gallium: fix some texture object leaks
authorBrian Paul <brian.paul@tungstengraphics.com>
Mon, 19 May 2008 18:40:11 +0000 (12:40 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Mon, 19 May 2008 18:40:49 +0000 (12:40 -0600)
src/gallium/auxiliary/draw/draw_pipe_aaline.c
src/gallium/auxiliary/draw/draw_pipe_pstipple.c

index f501b2aed411c0d3705bf54647c67d1e1b5d71df..346a96e37fdec3c5ce04f5f0e0a2c6306668c54c 100644 (file)
@@ -713,6 +713,11 @@ static void
 aaline_destroy(struct draw_stage *stage)
 {
    struct aaline_stage *aaline = aaline_stage(stage);
+   uint i;
+
+   for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
+      pipe_texture_reference(&aaline->state.texture[i], NULL);
+   }
 
    if (aaline->sampler_cso)
       aaline->pipe->delete_sampler_state(aaline->pipe, aaline->sampler_cso);
@@ -836,6 +841,9 @@ aaline_set_sampler_textures(struct pipe_context *pipe,
    for (i = 0; i < num; i++) {
       pipe_texture_reference(&aaline->state.texture[i], texture[i]);
    }
+   for ( ; i < PIPE_MAX_SAMPLERS; i++) {
+      pipe_texture_reference(&aaline->state.texture[i], NULL);
+   }
    aaline->num_textures = num;
 
    /* pass-through */
index 73ee41985802ba82d43906c44b75c30fde2da56a..2dfd1800d550455251603dba959be29ff8b6489d 100644 (file)
@@ -559,6 +559,11 @@ static void
 pstip_destroy(struct draw_stage *stage)
 {
    struct pstip_stage *pstip = pstip_stage(stage);
+   uint i;
+
+   for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
+      pipe_texture_reference(&pstip->state.textures[i], NULL);
+   }
 
    pstip->pipe->delete_sampler_state(pstip->pipe, pstip->sampler_cso);