Destructor of array item not called on OwnedArray::clear()?


#1

has anybody an idea why this might happens?

with this Array i have a strange problem.

OwnedArray<AutomationNode> nodes;

if i iterate through the array and delete the objects individually it works.

for(int i = nodes.size() ; -- i >= 0 ;)
{
	AutomationNode* node = nodes.getUnchecked(i);
	nodes.remove(i,false);
	deleteAndZero(node);
}

but when i call the clear method it the destructors of the “AutomationNode” objects are not called.

nodes.clear();

there is nothing special going on with the AutomationNode class, afaict.
i’m a bit puzzled.

thanks :slight_smile:

jm

p.s.: maybe i haven’t just sleept enough :wink:


#2

The clear() method is extremely simple - just step into it and see what happens.


#3

i know, did that already.
just does what it is supposed to do, deleting two items.
but the destructor of the items is not getting invoked.
seems not to be a juce related problem, rather a general problem. maybe the compiler system uses a forward declaration of the AutomationNode class or something for the clear method? would be strange thought, as the manual deletion just works in the same scope.
i was just asking, in case something jumps to ones mind if he hears of this problem.

cheers

jm


#4

Sounds like some compiler files have got out of step… Clean rebuild!