Results 1 to 3 of 3

Thread: COLLADA_DOM daeIntegrationObjects cleanup

  1. #1
    Junior Member
    Join Date
    Mar 2006
    Posts
    2

    COLLADA_DOM daeIntegrationObjects cleanup

    Hello,

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

    Code :
    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:

    Code :
    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

  2. #2
    Senior Member
    Join Date
    Aug 2005
    Location
    California
    Posts
    165
    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

  3. #3
    Junior Member
    Join Date
    Mar 2006
    Posts
    2
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •