Marco van de Voort wrote 11 lines
In our previous episode, Michael Van Canneyt said:
>> Since in both cases the resultparent is an already used reference, shouldn't
>> it be increfed ?
>
> Probably.
>
> Till you told me, I wasn't even aware that there was a refcounting mechanism.
> I see no reason why there should be one, so I'd be in favour of removing it
> alltogether.
Then you need some global list to add them to. (to be able to deallocate).
Why ?
It might be the various TPasModule sections already double as something like
this, but that has to be validated.
Each element should deallocate it's "children".
Since an element tree is always a strict tree, this is unambiguous. Refcounting is not 'm not in favour of a global list and a 'garbage collection' style of memory management. It makes manipulating the tree a pain.
This will take some reworking, apparently (each destructor must be filled with code to deallocate children). For the time being, try the incref.
Michael.