×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Jun 2004
    Posts
    86

    Display jpeg on grid list gives kern-exec 3?

    hello everyone!

    i am trying to display a jpeg image on a grid list. The jpeg image gets displayed. But then if i exit the app, it gives me a Kern-Exec 3 error. after i convert the jpeg image to bitmap, and then scale it down.. i call AddDataL() so that the jpeg image will be displayed after the jpeg has been scaled. i have the following code:

    Code:
    void CSimpleGridContainer::LoadGraphicsL()
    	{
    	TBuf<256> pathAppMbm;
    	iCoeEnv->ReadResource(pathAppMbm, R_ICON_FILE_NAME);
    	CArrayPtr<CGulIcon>* icons = new (ELeave) CAknIconArray(8);
    	CleanupStack::PushL(icons);
    
    	CFbsBitmap* mask = iEikonEnv->CreateBitmapL(pathAppMbm, EMbmSimplegridCard_mask);
    	CleanupStack::PushL(mask);	
    	CFbsBitmap* bitmap = iEikonEnv->CreateBitmapL(pathAppMbm, EMbmSimplegridSnap);
    	CleanupStack::PushL(bitmap);
    	icons->AppendL(CGulIcon::NewL(bitmap, mask));
    	CleanupStack::Pop(bitmap);
    	CleanupStack::Pop(mask);
    
    	...
    
    	CFbsBitmap* mask6 = iEikonEnv->CreateBitmapL(pathAppMbm, EMbmSimplegridCard_mask);
    	CleanupStack::PushL(mask6);	
    	CFbsBitmap* bitmap6 = iEikonEnv->CreateBitmapL(pathAppMbm, EMbmSimplegridPoker);
    	CleanupStack::PushL(bitmap6);
    	icons->AppendL(CGulIcon::NewL(bitmap6, mask6));
    	CleanupStack::Pop(bitmap6);
    	CleanupStack::Pop(mask6);
    	
    	//IF I COMMENT THIS BLOCK OUT, THE KERN-EXEC ERROR IS GONE
    	if(iConvertState == EConvertStateReady)
    		{
    		CFbsBitmap* mask7 = iEikonEnv->CreateBitmapL(pathAppMbm, EMbmSimplegridCard_mask);
    		CleanupStack::PushL(mask7);
    		icons->AppendL(CGulIcon::NewL(iBitmap, mask7));
    		CleanupStack::Pop(mask7);
    		}
    		
    	iGamesGrid->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
    	CleanupStack::Pop(icons);
    	}
    this is my ConstructL:
    Code:
    void CSimpleGridContainer::ConstructL(const TRect& aRect)
    	{
    	CreateWindowL();
    
    	// Construct the grid
    	iGamesGrid = new (ELeave) CAknGrid;
    	iGamesGrid->SetContainerWindowL(*this);
    	
    	iGridM = new (ELeave) CAknGridM;
    	
    	iGamesGrid->SetModel(iGridM);
    	iGamesGrid->ConstructL(this, EAknListBoxSelectionGrid);
    
    	...
    	
    	//create resource for grid (do not load from the HRF file)
    	LoadGraphicsL();
    	AddDataL(7);
    	
    	SetRect(aRect);
    	ActivateL();
    
    	...
    	
    	iBitmap = new (ELeave) CFbsBitmap();
    	iScaler = CMdaBitmapScaler::NewL();
    	iConverter = CMdaImageFileToBitmapUtility::NewL(*this);
    	iConverter->OpenL(KJpegFileName);
    	}
    this is my destructor:
    Code:
    CSimpleGridContainer::~CSimpleGridContainer()
    	{
    	delete iGamesGrid;
    
    	delete iScaler;
    	iScaler = NULL;
    	
    	delete iConverter;
    	iConverter = NULL;
    	
    	delete iBitmap;
    	iBitmap = NULL;
    	}
    this is my code when the scaling of the image has been performed:
    Code:
    void CSimpleGridContainer::ScalingFinished(TInt aError)
    	{
    	if (aError == KErrNone)
    		{
    		iConvertState = EConvertStateReady;
    		LoadGraphicsL();
    		AddDataL(1);
    		}
    	}
    What could be the problem with my code? please help. i would greatly appreciate it. thank you.

  2. #2
    Regular Contributor
    Join Date
    Jun 2004
    Posts
    86

    solved!

    i solved it.. i found out that i shouldn't delete the iBitmap in the destructor.. :)

Posting Permissions

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