uifw/AvKon/src/AknViewAppUi.cpp
branchRCL_3
changeset 15 c52421ed5f07
parent 13 a8834a2e9a96
child 18 fcdfafb36fe7
--- a/uifw/AvKon/src/AknViewAppUi.cpp	Wed Jun 09 09:58:37 2010 +0300
+++ b/uifw/AvKon/src/AknViewAppUi.cpp	Mon Jun 21 15:57:43 2010 +0300
@@ -319,15 +319,23 @@
 	
 	for ( TInt i = 0; i < count; ++i )
 		{
-		CAknView* view( iViews->At( i ) );
-		
-		if ( view->Id() == aViewId )
-			{
-			iViews->Delete( i );
-			CCoeAppUi::DeregisterView( *view );
-			delete view;
-			return;
-			}
+        CAknView* view( iViews->At( i ) );
+        if ( view->Id() == aViewId )
+            {
+            // remove the deleted view from iExtensione's list. Or the pointer 
+            // is invalid 
+            TInt index = iExtension->iActiveViews.Find(view);
+            if ( index >= 0 && index < iExtension->iActiveViews.Count() )
+                {
+                iExtension->iActiveViews.Remove(index);
+                view->AknViewDeactivated();
+                } 
+                
+                iViews->Delete( i );
+                CCoeAppUi::DeregisterView( *view );
+                delete view;
+                return;
+            }
 		}
 	}
 
@@ -618,12 +626,15 @@
             // (default granularity is 8) -> no memory allocation failures.
             if ( splitView )
                 {
-                iExtension->iActiveViews.Append( View( splitView->iViewIds[0] ) );
-                iExtension->iActiveViews.Append( View( splitView->iViewIds[1] ) );
+                error = iExtension->iActiveViews.Append( View( splitView->iViewIds[0] ) );
+                if (KErrNone == error)
+                    {
+                    error = iExtension->iActiveViews.Append( View( splitView->iViewIds[1] ) );
+                    }
                 }
             else
                 {
-                iExtension->iActiveViews.Append( item->iNewView );
+                error = iExtension->iActiveViews.Append( item->iNewView );
                 }
 
             iView = item->iNewView;