I have two Views in my application. Since the Views are CAknView derived I dont call the View's destructors from AppUi. So my AppUi destructor is empty. I have instance variables (like a pointer to CArrayFixFlat) in the two View's which are dynamically allocated. I delete those instance variables in the View's destructors as follows:
My application needs to be switched from one view to the other when the user clicks appropriate menu. So i have deleted the instance variables in the DoDeactivate() method of the View's using the above code.
if(iVariable != NULL)
iVariable = NULL;
I have set break points in the open set brackets of the AppUi's and the two View's destructor. When debugging I found that the panic is raised after the call to Exit() in AppUi and before any of the destructor is called. I Stepped into Exit() and found that the panic is raised when executing avkon.dll. I cant find any place where i accessing a NULL pointer by mistake (I can say this because i ensure that the pointer is not NULL before calling delete on it both in the View's DoDeactivate() and the Destructors). Thanks.