[cogl/wip/cogl-1.14: 106/177] matrix-stack: getting parent ptr before freeing
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/wip/cogl-1.14: 106/177] matrix-stack: getting parent ptr before freeing
- Date: Mon, 21 Jan 2013 15:53:50 +0000 (UTC)
commit 2fcc2f2f93e53991122434ed68e991c6df114d88
Author: Robert Bragg <robert linux intel com>
Date: Tue Nov 27 22:02:56 2012 +0000
matrix-stack: getting parent ptr before freeing
When unrefing a CoglMatrixEntry we walk up the ancestry unrefing and
freeing entries until we find an entry that doesn't need to be freed.
The problem fixed by this patch was that we didn't dereference the
parent member of each entry until after the entry was freed and so there
was the potential for reading a junk parent pointer back.
(cherry picked from commit e5d836b84acb35a009854a0cc0892320023789d1)
cogl/cogl-matrix-stack.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/cogl/cogl-matrix-stack.c b/cogl/cogl-matrix-stack.c
index 907bd66..8ec4100 100644
--- a/cogl/cogl-matrix-stack.c
+++ b/cogl/cogl-matrix-stack.c
@@ -328,8 +328,12 @@ _cogl_matrix_entry_ref (CoglMatrixEntry *entry)
void
_cogl_matrix_entry_unref (CoglMatrixEntry *entry)
{
- for (; entry && --entry->ref_count <= 0; entry = entry->parent)
+ CoglMatrixEntry *parent;
+
+ for (; entry && --entry->ref_count <= 0; entry = parent)
{
+ parent = entry->parent;
+
switch (entry->op)
{
case COGL_MATRIX_OP_LOAD_IDENTITY:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]