|
|
@@ -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();
|