diff -r aecbbf00d063 -r d48ab3b357f1 uifw/AvKon/src/AknViewAppUi.cpp --- a/uifw/AvKon/src/AknViewAppUi.cpp Tue Aug 31 15:28:30 2010 +0300 +++ b/uifw/AvKon/src/AknViewAppUi.cpp Wed Sep 01 12:16:19 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -27,6 +27,10 @@ #include #include #include +#include +#include + + #include "aknview.h" #include "aknshut.h" #include "aknenv.h" @@ -43,6 +47,8 @@ // CONSTANTS const TInt KAknAppUiViewsGranularity = 1; const TInt KAknViewAsyncPriority = EActivePriorityRedrawEvents + 10; + + #ifdef RD_SPLIT_VIEW const TInt KAknSplitViewSize = 2; @@ -228,12 +234,20 @@ iExtension->iNavigator = new ( ELeave ) CAknViewNavigator( this ); AddToStackL( iExtension->iNavigator, ECoeStackPriorityDefault - 1, ECoeStackFlagRefusesFocus ); #endif // RD_SPLIT_VIEW - - if ( iEikonEnv->RootWin().OrdinalPosition() == 0 && // only clear the window for foreground apps + + // Only clear the window for foreground apps. + if ( iEikonEnv->RootWin().OrdinalPosition() == 0 && iExtension->iUseDefaultScreenClearer ) - { - iClearer = CAknLocalScreenClearer::NewL( ETrue ); - } + { + if ( !iEikonEnv->StartedAsServerApp() ) + { + iClearer = CAknLocalScreenClearer::NewL( ETrue ); + } + else + { + iClearer = CAknLocalScreenClearer::NewL( ETrue, ETrue ); + } + } } // ----------------------------------------------------------------------------- @@ -247,18 +261,18 @@ if (iExtension && iExtension->iNavigator ) RemoveFromStack( iExtension->iNavigator ); #endif // RD_SPLIT_VIEW - + // Hide application toolbar to prevent it from showing // after views are deleted if ( CAknAppUi::CurrentFixedToolbar() ) { - CAknAppUi::CurrentFixedToolbar()->SetToolbarVisibility( EFalse ); + CAknAppUi::CurrentFixedToolbar()->SetToolbarVisibility( EFalse ); } - delete iClearer; - delete iShutter; - delete iActivationTick; - + delete iClearer; + delete iShutter; + delete iActivationTick; + if ( iActivationQueue ) { iActivationQueue->ResetAndDestroy(); @@ -312,15 +326,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; + } } } @@ -611,12 +633,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;