Xlib: unexpected async reply



Dear all,

I have been trying to display video images from a DV camera. My
application is multi-threaded and I am using pthread class. After
grabbing a frame, I try to display it in a DrawingArea. I am getting an
error message such that: "Xlib: unexpected async reply"
Here is the code:

static void *videoThread( void *p )
{
   int lastPosition = -1;

   capture_active = TRUE;
   CustomDrawingArea *drawingarea = ( CustomDrawingArea* ) p;
   prevFramesWritten = 0;

       // Lock the gui
       gdk_threads_enter();
   while (capture_active)
   {
       ...grab the frame
       //display it
       drawingarea->drawImage(pixels,width,height,3*width);
                       gdk_flush();
                       gdk_threads_leave();
   }
}

void CustomDrawingArea::drawImage(unsigned char* data,int width, int
height,int rowstride)
{
       Glib::RefPtr<Gdk::Window> win = get_window();
       gc = Gdk::GC::create(win);
       win->clear();

       Glib::RefPtr<Gdk::Pixbuf> image = Gdk::Pixbuf::create_from_data
(data,Gdk::COLORSPACE_RGB,FALSE,8,width,height,rowstride);
       image->render_to_drawable(win,gc,
           0, 0, 0, 0, image->get_width(), image->get_height(),
           Gdk::RGB_DITHER_NONE, 0, 0);

}
My application is a gtkmm application. Even I use gdk_threads_enter /
leave() I still get the error, but my application does not crash. It
does not show the image; however when I resize the window, I can see the
image sometimes. I followed the source code of "kino" to build my
application. What causes this error? Please help me on this. Any help is
greatly appreciated. Thank you very much for your time.
Regards,





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]