Thanks vineet.jain and symbianyucca for reply. My code looks as follows
Code:
RPointerArray<CMyObject> iPtrArr;
CMyObject* iMyObj;
void RemoveObject(TInt index)
{
CMyObject* obj = iPtrArr.operator [](index);
iPtrArr.Remove(index);
delete obj;
obj = NULL;
iPtrArr.Compress();
}
void GetObject(TInt index)
{
if(index<iPtrArr.Count)
CMyObject* obj = iPtrArr.operator [](index);
if(obj)
{
iMyObj = obj;
}
}
I am sometimes getting KERN-EXEC 3 while using above codes.I have to randomly add and remove objects from the array.It may happen that array has 4 items ( 0,1,2,3 ), now item 1 is deleted and then GetObject is called with index 1. what will happen in that case?
thanks