COLLADA_DOM daeIntegrationObjects cleanup

Hello,

I’m experimenting leaks with daeIntegrationObjects.
I had a look to the code and saw:

class daeIntegrationObject
{
    /** A smartRef to the element associated with this integration object. */
    daeElementRef _element;
}

class daeElement
{
    daeIntegrationObject* _intObject;
    ~daeElement()
    {
        if (_intObject)
             _intObject->release();
    }
}

I’m quite confused about what owns what here.

In the integration example, I saw:

class intGeometry : public daeIntegrationObject
{
    daeElement* _element;
}

which would make daeElement own daeIntegrationObject

Do I have to do as in the integration example (ignore the daeElementRef daeIntegrationObject::_element) or do I miss something ?

Regards,
Guillaume

I don’t know why the integration sample redefines _element.
It is not needed, you can use the _element defined in the daeIntegrationObject base class.

And as far as I know, the daeElement owns the daeIntegrationObject.

-Andy

Well, the sample way seems to be right way.
If I use the _element defined in the daeIntegrationObject base class, the daeIntegrationObject adds a ref count on _element, both objects own each other and I get a leak.
I used a plain old pointer instead of daeElementRef _element in my integration objects and it works as expected: the daeElement destroys the daeIntegrationObject.

  • Guillaume