Problem With RWsSession::Flush()

Login to reply to this topic.
Wed, 2005-06-15 07:33
Joined: 2004-10-01
Forum posts: 35
Hi All,
I have a YUV file which i want to display on the screen. First I convert YUV frame to RGB data and copy this to the CFbsBitmap object. Now I am drawing this RGB frame to the screen using the following code. I am calling the following code from a thread created by the main application thread.

void CExampleAppView::Draw_Image(CFbsBitmap* aImage,unsigned int img_width,unsigned int img_height)
{
               CWindowGc& gc = SystemGc();

   gc.Activate(Window());

   TRect drawRect=Rect();
   
   TPoint pos;
   
   pos.iX =(240-(int)img_width)/2;
                pos.iY =(320-(int)img_height)/2;

   gc.BitBlt(pos,aImage);

   gc.Deactivate();

   RWsSession  temp = iCoeEnv->WsSession();

RDebug::Printf("\n temp.Flush() \n");

   temp.Flush();
RDebug::Printf("\n Passed Flush \n");
}


When it executes temp.Flush() line. A prompt with KERN_EXEC 0 error comes. I am unable to understand why this is happening.
When i comment this line, which i believe i should not, it works fine but it jumps off few frames then display the next frame and so on.

Please help me in this regard.

Pinky



Wed, 2005-06-15 11:45
Joined: 2004-05-24
Forum posts: 56
Re: Problem With RWsSession::Flush()
KERN-EXEC 0 panic is raised when the Kernel Executive cannot find an object in the object index for the current process or current thread using the specified object index number (the raw handle number).

In your case RWsSession& returned by CCoeEnv::WsSession becomes invalid in created thread because it contains the kernel object index for the another thread.

hope this helps!
Wed, 2005-06-15 14:36
Joined: 2004-10-01
Forum posts: 35
Re: Problem With RWsSession::Flush()
This could be true but the problem is that the same code was working fine with the previous weekly release of symbian SDK.

Anyways, How can i get rid of this problem? I need to call this function in a separate thread. Is there any workaround??

Thanks
Pinky
Wed, 2005-06-15 15:13
Joined: 2004-05-24
Forum posts: 56
Re: Problem With RWsSession::Flush()
Quote
same code was working fine with the previous weekly release of symbian SDK
It's just a coincidence. Separate threads may have different sets of kernel object indices.

The only way I see is to notify another thread that RWsSession::Flush needed to be called and call it from this thread. But it seems to be not a good solution.

Best regards.
Wed, 2005-06-15 15:20
Joined: 2004-05-24
Forum posts: 56
Re: Problem With RWsSession::Flush()
Another way is to use
Code:
RWsSession::SetAutoFlush(TBool aState);
If auto-flush is set to ETrue, the window server buffer is flushed immediately anything is put into it, instead of waiting until it becomes full.

But in documentation you can also find the folowing
Quote
This setting is normally used only in a debugging environment.

But if there is no another way...

BR,
addonic
  • Login to reply to this topic.