Mesa (master): glsl: Add assert to check variable_entry referenced_count after construction.

Vinson Lee vlee at kemper.freedesktop.org
Tue Aug 24 08:32:13 UTC 2010


Module: Mesa
Branch: master
Commit: c8b26c63fdad84d311748a24972146b6a371ab31
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c8b26c63fdad84d311748a24972146b6a371ab31

Author: Vinson Lee <vlee at vmware.com>
Date:   Tue Aug 24 01:16:46 2010 -0700

glsl: Add assert to check variable_entry referenced_count after construction.

A variable_entry after construction should have its referenced_count
member set to 0. However, occassionally this isn't the case and
entry->referenced_count has been observed to be a garbage value. This
leads to crashes of several tests in the Piglit test suite.

This patch adds an assert to check that a variable_entry instance has
its referenced_count member initialized to 0 after construction.

---

 src/glsl/ir_variable_refcount.cpp |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/glsl/ir_variable_refcount.cpp b/src/glsl/ir_variable_refcount.cpp
index 20c2f66..6614727 100644
--- a/src/glsl/ir_variable_refcount.cpp
+++ b/src/glsl/ir_variable_refcount.cpp
@@ -45,6 +45,7 @@ ir_variable_refcount_visitor::get_variable_entry(ir_variable *var)
    }
 
    variable_entry *entry = new(mem_ctx) variable_entry(var);
+   assert(entry->referenced_count == 0);
    this->variable_list.push_tail(entry);
    return entry;
 }




More information about the mesa-commit mailing list