KErrCouldNotConnect - Loading CFbsBitmap in Thread

Login to reply to this topic.
Thu, 2005-06-23 11:18
Joined: 2005-05-25
Forum posts: 48
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

Thu, 2005-06-23 17:26
Joined: 2004-06-06
Forum posts: 205
Re: KErrCouldNotConnect - Loading CFbsBitmap in Thread
AFAIK you will need a new connection to FBs

Best regards,
Michal Laskowski

Fri, 2005-06-24 09:35
Joined: 2005-05-25
Forum posts: 48
Re: KErrCouldNotConnect - Loading CFbsBitmap in Thread
Hi there,

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
Mon, 2005-06-27 09:07
Joined: 2005-05-25
Forum posts: 48
Re: KErrCouldNotConnect - Loading CFbsBitmap in Thread
Any other ideas or comments?
Fri, 2006-06-16 15:23
Joined: 2006-02-02
Forum posts: 2
Re: KErrCouldNotConnect - Loading CFbsBitmap in Thread
2 DYnz :
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
Sat, 2006-06-24 14:41
Joined: 2004-11-29
Forum posts: 1233
Re: KErrCouldNotConnect - Loading CFbsBitmap in Thread
Just calling RFbsSession::Connect() should do the trick.

It uses tls, so no need to pass it around.
  • Login to reply to this topic.