Am 07.08.2014 um 13:51 schrieb pulkomandy@xxxxxxxxxxxxx: > - entry_ref* ref; > - while ((ref = entryList->RemoveItemAt(0)) != NULL) > - delete ref; > + for (int i = 0; i < entryList->CountItems(); i++) > + delete entryList->ItemAt(i); > delete entryList; Sorry, should have kept reading mails before replying. But anyway, please use the form I pointed out in my first reply. ItemAt() has bounds checks, which are unnecessary here, so use ItemAtFast() if you iterate all items. And the compiler can’t know if CountItems() gives different results at each iterations. That could be the case if for example an item removes itself from the list in its destructor (not the case here, but the compiler probably does not know). And even if the compiler knows all the code for the item destructor, it does not know if you perhaps change the list from another thread, so I am pretty sure that CountItems() is a function call in each iteration. Just iterate backwards if you know better than the compiler. Best regards, -Stephan