diff --git a/dtool/src/interrogate/typeManager.cxx b/dtool/src/interrogate/typeManager.cxx index ab1fbffce3..dba10f4520 100644 --- a/dtool/src/interrogate/typeManager.cxx +++ b/dtool/src/interrogate/typeManager.cxx @@ -1442,7 +1442,7 @@ is_void(CPPType *type) { /** * Returns true if the indicated type is some class that derives from - * ReferenceCount, or false otherwise. + * ReferenceCount, or defines ref and unref(), or false otherwise. */ bool TypeManager:: is_reference_count(CPPType *type) { @@ -1459,6 +1459,14 @@ is_reference_count(CPPType *type) { case CPPDeclaration::ST_struct: { CPPStructType *stype = type->as_struct_type(); + + // If we have methods named ref() and unref(), this is good enough. + if (stype->_scope->_functions.count("ref") && + stype->_scope->_functions.count("unref") && + stype->_scope->_functions.count("get_ref_count")) { + return true; + } + CPPStructType::Derivation::const_iterator di; for (di = stype->_derivation.begin(); di != stype->_derivation.end();