Panic due to CFbsBitmap loaded in Font and bitmap server
| Thu, 2005-02-17 09:25 | |
|
I am using the CImageEncoder class to encode a bitmap that I load like this; ---- _LIT(KTestMBM, "Z:\\system\\Apps\\T_ItFjmmSaveImageCat1\\T_ItFjmmSaveImage.MBM"); CFbsBitmap* bitty = new (ELeave) CFbsBitmap; bitty->Load( KTestMBM, 0, EFalse); ---- The MBM file exists and there is no problem loading the bitmap. Later on when I use the CImageEncode below there is a Panic. ---- // Load the file TRAPD(err, iEncoder = CImageEncoder::FileNewL( iFs, aFileName, CImageEncoder::EOptionNone, KImageTypeJPGUid )); if(err != KErrNone) { User::Leave(err); } ---- Now the reason for the Panic I understand. I am testing the application I made and am using an incorrect filename for the aFileName as the second parameter for the above FileNewL() API. Now here is the problem that I would really appreciate help with. After the Leave in the above code the process returns to where I call FileNewL from. It is a test application and a snippet of its source was included at the top of this posting. Because of the Leave I try to release the memory that the CFbsBitmap reserves by the follwing; bitty->Reset(); delete bitty; bitty = NULL; Despite this the font and bitmap server doesn't release the bitmap data and I get a Panic after the Leave. I understand that the CFbsBitmap pointer bitty is simply a handle to the data held by the font and bitmap server. I would like to know how to tell the bitmap server to release its memory since it is no longer needed. Or advice with maybe a solution where the test application and dll I am testing are in separate threads. Although I am getting out of my depth with that. I appreciate any help you can give. Niimidan |
|






Forum posts: 22
CFbsBitmap* bitty = new (ELeave) CFbsBitmap;
CleanupStack::PushL(bitty);
User::LeaveIfError(bitty->Load( KTestMBM, 0, EFalse));
iEncoder = CImageEncoder::FileNewL( iFs, aFileName, CImageEncoder::EOptionNone, KImageTypeJPGUid ));
...
CleanupStack::PopAndDestroy(bitty); // or just Pop, if you want to keep it around
Forum posts: 26
I tried the
TRAP(ret, saveImage.SaveJpegL(KDestJPEGFileError, *this, info ) );
if(ret != KErrNone)
{
CleanupStack::PopAndDestroy( bitty ); // Elk's suggestion
User::Leave( ret );
}
...
Even with that, the pesky Font and Bitmap server does not release that area of memory taken up at this point in the code.
User::LeaveIfError(bitty->Load( KTestMBM, 0, EFalse));
Once I load the bitmap from the MBM file, I can't seem to release the memory from the server.
Is there something else I can try?
Thanks for the help.
Niimidan
Forum posts: 26
__UHEAP_MARK;
_LIT(KTestMbm, "Z:\\SYSTEM\\APPS\\HelloWorld\\T_TestBitmap.MBM");
TInt id = 0;
CFbsBitmap* bitty = new (ELeave) CFbsBitmap();
bitty->Load(KTestMbm, 0, EFalse);
bitty->Reset();
delete bitty;
bitty = NULL;
__UHEAP_MARKEND;
At __UHEAP_MARK a Panic occurs. The bitmap itself is deleted but something is still not released from the server. Hmmm. Please help.
Niimidan
Forum posts: 26
Basically in my case, the deletion of the memory representing the CFbsBitmap object takes place asynchrously, as the CFbsBitmap was large, the cleanup actually took place after the session ended.
I ended up using a client / server architecture and checked the heap using __UHEAP_MARKEND; after the session was closed.
Niimidan
Forum posts: 26
S