[clutter/clutter-1.6] cogl-vertex-buffer: make sure to unref weak pipelines
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/clutter-1.6] cogl-vertex-buffer: make sure to unref weak pipelines
- Date: Tue, 14 Jun 2011 13:28:57 +0000 (UTC)
commit 16a0b84bca35e232d24762821ad7ea0ff5de0d5f
Author: Robert Bragg <robert linux intel com>
Date: Wed Jun 8 17:52:28 2011 +0100
cogl-vertex-buffer: make sure to unref weak pipelines
When validating a user pipeline before drawing with a CoglVertexBuffer
we sometimes find we have to make some overrides and we handle that by
creating a pipeline which is a weak copy of the user pipeline. The weak
pipeline gets associated with the original pipeline so if that pipeline
is used multiple times then we can re-use the same override pipeline and
skip validation. Because it's a weak pipeline we get notified when the
original material is destroyed or changed so we know our weak pipeline
is now invalid.
When we get notified that the weak material is invalid we should unref
it, but instead we were just discarding our reference to it. This was
resulting in leaking weak materials and in some cases those materials
referenced textures which would then also be leaked.
Cherry-picked from Cogl's commit:
c603dc67ca13d26e3909196500da693a92654dee
clutter/cogl/cogl/cogl-vertex-buffer.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/clutter/cogl/cogl/cogl-vertex-buffer.c b/clutter/cogl/cogl/cogl-vertex-buffer.c
index f9fac14..22c02b4 100644
--- a/clutter/cogl/cogl/cogl-vertex-buffer.c
+++ b/clutter/cogl/cogl/cogl-vertex-buffer.c
@@ -1497,6 +1497,9 @@ weak_override_source_destroyed_cb (CoglPipeline *pipeline,
void *user_data)
{
VertexBufferMaterialPrivate *pipeline_priv = user_data;
+ /* Unref the weak pipeline copy since it is no longer valid - probably because
+ * one of its ancestors has been changed. */
+ cogl_object_unref (pipeline_priv->real_source);
pipeline_priv->real_source = NULL;
/* A reference was added when we copied the weak material so we need
to unref it here */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]