From daa3100bf194592fb8ac865dd1ab8015f4399651 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 19 Dec 2018 20:47:57 +0100 Subject: [PATCH] pgraph: mark TransformState as invalid in destructor This, in combination with ebef9f3de8d2eb1c3628a25fe3bd08aa59c8804d, makes it easier to catch issues in code that is accidentally letting get temporary TransformState objects get destroyed. It does not affect release builds. --- panda/src/pgraph/transformState.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/panda/src/pgraph/transformState.cxx b/panda/src/pgraph/transformState.cxx index 4d02425683..fc8b3de606 100644 --- a/panda/src/pgraph/transformState.cxx +++ b/panda/src/pgraph/transformState.cxx @@ -96,6 +96,10 @@ TransformState:: // true now, probably we've been double-deleted. nassertv(get_ref_count() == 0); _cache_stats.add_num_states(-1); + +#ifndef NDEBUG + _flags = F_is_invalid | F_is_destructing; +#endif } /**