can't query TypeHandle::none() pointers

This commit is contained in:
David Rose 2011-09-08 15:19:21 +00:00
parent 369f93951f
commit 0ce0196027
2 changed files with 4 additions and 8 deletions

View File

@ -96,7 +96,7 @@ show() const {
for (vi = count_sorter.begin(); vi != count_sorter.end(); ++vi) { for (vi = count_sorter.begin(); vi != count_sorter.end(); ++vi) {
TypeHandle type = (*vi)._type; TypeHandle type = (*vi)._type;
if (type == TypeHandle::none()) { if (type == TypeHandle::none()) {
nout << "undefined type (TypeHandle::none())"; nout << "unknown";
} else { } else {
nout << type; nout << type;
} }
@ -850,12 +850,8 @@ ns_get_pointers_of_type(MemoryUsagePointers &result, TypeHandle type) {
if (info->_freeze_index == _freeze_index && if (info->_freeze_index == _freeze_index &&
info->_ref_ptr != (ReferenceCount *)NULL) { info->_ref_ptr != (ReferenceCount *)NULL) {
TypeHandle info_type = info->get_type(); TypeHandle info_type = info->get_type();
if (type == TypeHandle::none() && if (info_type != TypeHandle::none() &&
info_type == TypeHandle::none()) { info_type.is_derived_from(type)) {
result.add_entry(info->_ref_ptr, info->_typed_ptr, info_type,
now - info->_time);
} else if (info_type != TypeHandle::none() &&
info_type.is_derived_from(type)) {
result.add_entry(info->_ref_ptr, info->_typed_ptr, info_type, result.add_entry(info->_ref_ptr, info->_typed_ptr, info_type,
now - info->_time); now - info->_time);
} }

View File

@ -239,7 +239,7 @@ output(ostream &out) const {
void MemoryUsagePointers:: void MemoryUsagePointers::
add_entry(ReferenceCount *ref_ptr, TypedObject *typed_ptr, add_entry(ReferenceCount *ref_ptr, TypedObject *typed_ptr,
TypeHandle type, double age) { TypeHandle type, double age) {
// We can't safly add pointers with a zero reference count. They // We can't safely add pointers with a zero reference count. They
// might be statically-allocated or something, and if we try to add // might be statically-allocated or something, and if we try to add
// them they'll try to destruct when the PointerTo later goes away. // them they'll try to destruct when the PointerTo later goes away.
if (ref_ptr->get_ref_count() != 0) { if (ref_ptr->get_ref_count() != 0) {