i915tex: Unreference texture buffers on context destruction.
authorMichel Dänzer <michel@tungstengraphics.com>
Thu, 16 Aug 2007 06:45:16 +0000 (08:45 +0200)
committerMichel Dänzer <michel@tungstengraphics.com>
Thu, 16 Aug 2007 06:46:55 +0000 (08:46 +0200)
Not doing this could cause the buffers to leak under some circumstances.

src/mesa/drivers/dri/i915tex/i830_vtbl.c
src/mesa/drivers/dri/i915tex/i915_vtbl.c

index a3db6c0c0cd391030664a600a765dda0d4977a5f..b2a1ba0ce34ac5bd6526adb9e1e94aaa430a6f40 100644 (file)
@@ -524,6 +524,16 @@ i830_emit_state(struct intel_context *intel)
 static void
 i830_destroy_context(struct intel_context *intel)
 {
+   GLuint i;
+   struct i830_context *i830 = i830_context(&intel->ctx);
+
+   for (i = 0; i < I830_TEX_UNITS; i++) {
+      if (i830->state.tex_buffer[i] != NULL) {
+        driBOUnReference(i830->state.tex_buffer[i]);
+        i830->state.tex_buffer[i] = NULL;
+      }
+   }
+
    _tnl_free_vertices(&intel->ctx);
 }
 
index ff99721769e11bef8c6b33c4f30feb854a9c6f50..1d651a40d75b3aec4bd45693d3f2dd99aaf6077f 100644 (file)
@@ -440,6 +440,16 @@ i915_emit_state(struct intel_context *intel)
 static void
 i915_destroy_context(struct intel_context *intel)
 {
+   GLuint i;
+   struct i915_context *i915 = i915_context(&intel->ctx);
+
+   for (i = 0; i < I915_TEX_UNITS; i++) {
+      if (i915->state.tex_buffer[i] != NULL) {
+        driBOUnReference(i915->state.tex_buffer[i]);
+        i915->state.tex_buffer[i] = NULL;
+      }
+   }
+
    _tnl_free_vertices(&intel->ctx);
 }