fix an assertion failure at shutdown

This commit is contained in:
David Rose 2011-09-09 01:17:35 +00:00
parent 00a87f7c44
commit 6064045aa3
6 changed files with 30 additions and 6 deletions

View File

@ -256,7 +256,9 @@ public:
return _type_handle; return _type_handle;
} }
static void init_type() { static void init_type() {
register_type(_type_handle, "GeomVertexData::CacheEntry"); GeomCacheEntry::init_type();
register_type(_type_handle, "GeomVertexData::CacheEntry",
GeomCacheEntry::get_class_type());
} }
private: private:

View File

@ -736,7 +736,7 @@ get_hash_impl() const {
Planes::const_iterator li; Planes::const_iterator li;
for (li = _on_planes.begin(); li != _on_planes.end(); ++li) { for (li = _on_planes.begin(); li != _on_planes.end(); ++li) {
NodePath plane = (*li); NodePath plane = (*li);
hash = int_hash::add_hash(hash, plane.get_key()); hash = plane.add_hash(hash);
} }
// This bool value goes here, between the two lists, to // This bool value goes here, between the two lists, to
@ -745,7 +745,7 @@ get_hash_impl() const {
for (li = _off_planes.begin(); li != _off_planes.end(); ++li) { for (li = _off_planes.begin(); li != _off_planes.end(); ++li) {
NodePath plane = (*li); NodePath plane = (*li);
hash = int_hash::add_hash(hash, plane.get_key()); hash = plane.add_hash(hash);
} }
return hash; return hash;

View File

@ -768,7 +768,7 @@ get_hash_impl() const {
Lights::const_iterator li; Lights::const_iterator li;
for (li = _on_lights.begin(); li != _on_lights.end(); ++li) { for (li = _on_lights.begin(); li != _on_lights.end(); ++li) {
NodePath light = (*li); NodePath light = (*li);
hash = int_hash::add_hash(hash, light.get_key()); hash = light.add_hash(hash);
} }
// This bool value goes here, between the two lists, to // This bool value goes here, between the two lists, to
@ -777,7 +777,7 @@ get_hash_impl() const {
for (li = _off_lights.begin(); li != _off_lights.end(); ++li) { for (li = _off_lights.begin(); li != _off_lights.end(); ++li) {
NodePath light = (*li); NodePath light = (*li);
hash = int_hash::add_hash(hash, light.get_key()); hash = light.add_hash(hash);
} }
return hash; return hash;

View File

@ -271,6 +271,26 @@ get_key() const {
return _head->get_key(); return _head->get_key();
} }
////////////////////////////////////////////////////////////////////
// Function: NodePath::add_hash
// Access: Published
// Description: Adds the NodePath into the running hash. This is
// intended to be used by lower-level code that computes
// a hash for each NodePath. It modifies the hash value
// passed in by a unique adjustment for each NodePath,
// and returns the modified hash.
//
// This is similar to the unique integer returned by
// get_key(), but it is not guaranteed to remain unique
// beyond the lifetime of this particular NodePath.
// Once this NodePath destructs, a different NodePath
// may be created which shares the same hash value.
////////////////////////////////////////////////////////////////////
INLINE size_t NodePath::
add_hash(size_t hash) const {
return pointer_hash::add_hash(hash, _head);
}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: NodePath::is_same_graph // Function: NodePath::is_same_graph
// Access: Published // Access: Published

View File

@ -37,6 +37,7 @@
#include "pta_LVecBase4f.h" #include "pta_LVecBase4f.h"
#include "pta_LVecBase3f.h" #include "pta_LVecBase3f.h"
#include "pta_LVecBase2f.h" #include "pta_LVecBase2f.h"
#include "stl_compares.h"
class NodePathCollection; class NodePathCollection;
class FindApproxPath; class FindApproxPath;
@ -211,6 +212,7 @@ PUBLISHED:
INLINE PandaNode *node() const; INLINE PandaNode *node() const;
INLINE int get_key() const; INLINE int get_key() const;
INLINE size_t add_hash(size_t hash) const;
INLINE bool is_same_graph(const NodePath &other, Thread *current_thread = Thread::get_current_thread()) const; INLINE bool is_same_graph(const NodePath &other, Thread *current_thread = Thread::get_current_thread()) const;
INLINE bool is_ancestor_of(const NodePath &other, Thread *current_thread = Thread::get_current_thread()) const; INLINE bool is_ancestor_of(const NodePath &other, Thread *current_thread = Thread::get_current_thread()) const;

View File

@ -432,7 +432,7 @@ get_hash_impl() const {
hash = pointer_hash::add_hash(hash, stage); hash = pointer_hash::add_hash(hash, stage);
hash = int_hash::add_hash(hash, (int)mode_def._mode); hash = int_hash::add_hash(hash, (int)mode_def._mode);
hash = string_hash::add_hash(hash, mode_def._source_name); hash = string_hash::add_hash(hash, mode_def._source_name);
hash = int_hash::add_hash(hash, mode_def._light.get_key()); hash = mode_def._light.add_hash(hash);
hash = mode_def._constant_value.add_hash(hash); hash = mode_def._constant_value.add_hash(hash);
} }