×

Discussion Board

Results 1 to 14 of 14
  1. #1
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    app crashes on orientation change

    Hello guys,

    I have this application which works fine in one orientation but when I change the orientation, it crashes and I don't know the reason also. Are there any specific reasons in this particular case?

    In HandleResourceChange of my container, I am doing the following:

    Code:
    	
    	CCoeControl::HandleResourceChange(aType);
    	SetRect(iAvkonViewAppUi->View(TUid::Uid(ESomeViewId))->ClientRect());
    
            CEikAppUi* appUi = CEikonEnv::Static()->EikAppUi();   
    	CEikApplication* app = appUi->Application();   
    	MAknsSkinInstance* skin = AknsUtils::SkinInstance();
    	TFileName bitmapFile;
    	bitmapFile = (app->BitmapStoreName());
    	bitmapFile.SetLength(bitmapFile.LocateReverse('\\') + 1);   
    	bitmapFile.Append(_L("Listbox_bitmaps.mif"));   
    	CAknsItemDef* pMenuSkinItemCBA = AknsUtils::CreateBitmapItemDefL( KAknsIIDQsnBgAreaMain, bitmapFile, 
    											EMbmListbox_bitmapsBackgroungcolor );
    	skin->SetLocalItemDefL( pMenuSkinItemCBA);
    If i just keep first two lines, the app does not crashes but it does not serve my purpose.

    Any suggestions why its crashing?

    Thanks

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,734

    Re: app crashes on orientation change

    A thing you may want to try is testing if the code can start up with changed orientation. If it can not, the problem is not about handling the change, but handling the orientation.
    And of course it may be a good idea checking the panic code.

  3. #3
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    Re: app crashes on orientation change

    Yes the code does work for me if I start the app in landscape orientation but again when i change that to portrait, it crashes and same thing if I start the app in portrait, it works fine but crashes on changing orientation to landscape. Can I get the panic code for release build because there are few libraries used by the app which are not available for emulator. So can't get it run on emulator. The problem occurs only on changing the orientation.

  4. #4
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,073

    Re: app crashes on orientation change

    Quote Originally Posted by raj8nokiaforum View Post
    Can I get the panic code for release build because there are few libraries used by the app which are not available for emulator. So can't get it run on emulator.
    yep you can : http://www.developer.nokia.com/Commu...ded_panic_code

  5. #5
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    Re: app crashes on orientation change

    Alright did that and found out that panic code is KERN-EXEC 0.
    Moreover, I did some file logging and found out that problem is not in HandleResourceChange method. Actually there is a listbox that I display on top of this .svg background image. On changing the orientation, somehow iListbox becomes NULL and in sizeChanged method, iListbox is NULL. But the panic codes suggests some NULL resource handle isn't it?

  6. #6
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    Re: app crashes on orientation change

    I am using RFs in my code but i don't know how handle to it is getting free because i am closing the RFs handle only in destructor. Any pointers?

  7. #7
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,073

    Re: app crashes on orientation change

    SetRect() invokes SizeChanged() which is the first statement in the HandleResourceChangeL().So you might want to put some more debug files after the SetRect() to see if code reaches till the end of HandleResourceChangeL() or not or/and put a log file at the end of SizeChanged() as well to see if code dies somewhere before completing that method.

  8. #8
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    Re: app crashes on orientation change

    First things Vineet I am not using HandleResourceChangeL function
    HTML Code:
    SetRect() invokes SizeChanged() which is the first statement in the HandleResourceChangeL()
    . I am using HandleResourceChange which is overridden in container.

    And this is what i tried:

    Code:
    void CMainFeaturesContainer::HandleResourceChange(TInt aType)
    	{
    	RFile file;
    	TBuf8<64>data8;
    	data8.Zero();
    	file.Create(CCoeEnv::Static()->FsSession(), _L("c:\\data\\orientation2.txt"), EFileWrite);
    	data8.Copy(_L8("5#"));
    	file.Write(data8);
    
    	// Call base class implementation
    	CCoeControl::HandleResourceChange(aType);
    	SetRect(iAvkonViewAppUi->View(TUid::Uid(EMainViewId))->ClientRect());
    
    	data8.Copy(_L8("6#"));
    	file.Write(data8);
    
    	iBackGround = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, Rect(), EFalse );
    	CreateListboxL();
    
    	data8.Copy(_L8("7#"));
    	file.Write(data8);
    
    	CEikAppUi* appUi = CEikonEnv::Static()->EikAppUi();   
    	CEikApplication* app = appUi->Application();   
    	MAknsSkinInstance* skin = AknsUtils::SkinInstance();
    	TFileName bitmapFile;
    	bitmapFile = (app->BitmapStoreName());
    	bitmapFile.SetLength(bitmapFile.LocateReverse('\\') + 1);   
    	bitmapFile.Append(_L("Listbox_bitmaps.mif"));
    	
    	data8.Copy(_L8("8#"));
    	file.Write(data8);
    
    	CAknsItemDef* pMenuSkinItemCBA = AknsUtils::CreateBitmapItemDefL( KAknsIIDQsnBgAreaMain, bitmapFile, 
    											EMbmListbox_bitmapsBackgroungcolor );
    	
    	data8.Copy(_L8("9#"));
    	file.Write(data8);
    
    	TRAPD(err, skin->SetLocalItemDefL( pMenuSkinItemCBA));
    
    	TBuf<10> buf; buf.Zero();
    	buf.AppendNum(err);
    	data8.Copy(buf);
    	file.Write(data8);
    
    	iListBox->SetRect(Rect());
    	
    	data8.Copy(_L8("11#"));
    	file.Write(data8);
    
    	SetIconsL();
    	
    	data8.Copy(_L8("12#"));
    	file.Write(data8);
    
    	SetItemsL();
    	
    	data8.Copy(_L8("13#"));
    	file.Write(data8);
    	file.Close();
    	}
    and the output of the file is 5#6#7#8#9# and the app crashes with KERN EXEC 0

  9. #9
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    Re: app crashes on orientation change

    and i believe the panic KERN EXEC 0 has to do with the RFile that i am using for logging because if i remove the file logging part, the panic is KERN EXEC 3. I don't know TRAPD isn't working in the code or what.

  10. #10
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,073

    Re: app crashes on orientation change

    I wrote the HandleResourceChangeL by myself so added that extra L by mistake.

    what happens if you comment out this line : TRAPD(err, skin->SetLocalItemDefL( pMenuSkinItemCBA)); , does the code proceeds further?

  11. #11
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    Re: app crashes on orientation change

    Ok i mentioned because the one you mentioned is overridden in AppUi and to make sure we are on the same page. Anyways yes if i comment this line, the code proceeds further as suggested by file logging again but here is the interesting part.

    If i comment this line and comment out file logging part as well because it was giving KERN EXEC 0 panic, the code works fine on changing the orientation but stays fine just for 2 seconds. After 2 seconds, app crashes with MEMORY FULL and KERN EXEC 3 together.

  12. #12
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,073

    Re: app crashes on orientation change

    Something seems to wrong with your sizechanged()/Draw() code i think , can you paste that part of code as here (Also are there any timers running in your code which update the UI or else)

  13. #13
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    Re: app crashes on orientation change

    No, there are no timers updating my ui.

    This is the Draw code:
    Code:
    void CMainContainer::Draw( const TRect& aRect ) const
    	{
    	CWindowGc& gc = SystemGc();
    	gc.SetPenStyle( CGraphicsContext::ENullPen );
    	gc.Clear();
    	MAknsSkinInstance* skin = AknsUtils::SkinInstance();
    	MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
    	AknsDrawUtils::Background( skin, cc, this, gc, aRect );
    	gc.DrawRect( aRect );	
    	}
    And this is the SizeChanged code:
    Code:
    void CMainContainer::SizeChanged()	
              {      
               if (iListBox)
    	   {
    	   iListBox->SetRect(Rect());
    	   }
    	DrawNow();
            }
    do you see anything wrong in here?

  14. #14
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    Re: app crashes on orientation change

    Alright i got it working. I removed everything except the iBackground thing and then setting the new Rect on list. It works.

    Thanks for being with me Vineet.

Similar Threads

  1. Replies: 3
    Last Post: 2010-09-03, 12:16
  2. Lock orientation change in N97
    By darshan.gandhi in forum Symbian User Interface
    Replies: 7
    Last Post: 2010-08-09, 04:50
  3. Can't change application UI orientation
    By SamoylovBoris in forum Symbian
    Replies: 5
    Last Post: 2007-07-25, 16:23

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×