KErrCouldNotConnect - Loading CFbsBitmap in Thread
| Thu, 2005-06-23 11:18 | |
|
Hi could some one please explain why I get KErrCouldNotConnect when I try loading a CFbsBitmap in Thread
TInt err2 = bitmap->Load(aFileName, bmpId);. Here is the code. TInt res = KErrNone; User::LeaveIfError( res = ProcessPhotos.Create( _L("ProcessPhotos") ,CMyApplication::StartAppThreadFunction,16384,1024*1024,1024*1024,this)); ProcessPhotos.SetPriority(EPriorityNormal); ProcessPhotos.Resume(); TInt CMyApplication::StartAppThreadFunction(TAny* aParam) { CTrapCleanup * cleanup = CTrapCleanup::New(); TInt err; if( cleanup == NULL ) { err = KErrNoMemory; } else { TRAP( err, StartAppThreadFunctionL(aParam) ); } delete cleanup; return err; } void CMyApplication::StartAppThreadFunctionL(TAny* aParam) { CMyApplication *engine = static_cast<CMyApplication*>(aParam); CFbsBitmap* bitmap = new (ELeave) CFbsBitmap(); CleanupStack::PushL(bitmap); _LIT(aFileName,"E:\\Images\\Library\\2003\\5\\1\\41s.mbm"); TInt bmpId = 0; TInt err2 = bitmap->Load(aFileName, bmpId); // error here CleanupStack::PopAndDestroy(); } thanks |
|






Forum posts: 205
Best regards,
Michal Laskowski
Forum posts: 48
could you please explain what you mean in alittle more detail. Also not sure what you mean by AFAIK? Do you mean I should just add the following lines
RFs fsSession;
User::LeaveIfError(fsSession.Connect());
I'm sure the fsSession would need to be passed or assigned to something? But I' not sure what?
thanks
Forum posts: 48
Forum posts: 2
It might help to call the static function RFbsSession::Connect() on start-up (in server constructor )
and RFbsSession::Disconnect() in destructor, and cause it's static u don't need to initialise RFbsSession. (and it should be RFbsSession, not "RFs as you did )
AFAIK - as far as i know
Forum posts: 1233
It uses tls, so no need to pass it around.