Mindtraveller wrote on Fri, 14 November 2008 13:14
testcase:
Any aa;
ArrayMap<unsigned, Any> am; //just something to pick aa
am.AddPick(0,aa);//aa is now picked
//and we have exception when aa is to be destroyed
cause:
The cause is internal Pick behaviour and Clear() member function. When object is picked, it`s internal ptr is set to (void *)1. When object is to be destroyed, it`s Clear() is called. But Clear() doesn`t check if ptr == (void *)1. It just checks if ptr is nonzero. What we have? Of course exception on trying to delete (*1);
proposal:
Change Clear() function to something like