Drawing on a widget from a thread (_XGetXCBBuffer: Assertion)
- From: Mohith Manoj <mohithmanoj gmail com>
- To: gtk-list gnome org
- Subject: Drawing on a widget from a thread (_XGetXCBBuffer: Assertion)
- Date: Fri, 23 Jan 2009 13:40:08 +0530
Hello,
In my application (which basically displays a running waveform), I have CWavePlot (derived from Gtk::Widget) and a main window (Gtk::Window). The main window instantiates a CWavePlot object and starts a thread (a gthread). This thread is given access to the original CMyClass object instance. This is what my thread function looks like
void CMyWnd::DrawManager(LPVOID lpvThrdInfo)
{
//... initialization
CWavePlot * pWavePlot = .......
//...Conditional loop
{
pWavePlot->Draw();
//... delay routine using nanosleep
}
}
and the Draw function of CWavePLot is implemented as below
void CWavePlot::Draw()
{
//...Initialization
//...initiate painting using Gdk::Window::begin_paint_rect
//...create a cairo context for the window
//...Cairo::move_to and Cairo::line_to to specify the line
//...Cairo::stroke to do the painting
//...Gdk::Window::end_paint to update the screen
}
when I run the code in my machine it runs for a variable amount of time (usually less than 5 seconds) and crashes with the following backtrace
Collection: xcb_lock.c:77: _XGetXCBBuffer: Assertion `((int) ((xcb_req) - (dpy->request)) >= 0)' failed.
Locking assertion failure. Backtrace:
#0 /usr/lib/libxcb-xlib.so.0 [0x2a3767]
#1 /usr/lib/libxcb-xlib.so.0(xcb_xlib_lock+0x2e) [0x2a390e]
#2 /usr/lib/libX11.so.6 [0x73b3109]
#3 /usr/lib/libX11.so.6(XUngrabPointer+0x25) [0x73a8d55]
#4 /usr/lib/libgdk-x11-2.0.so.0(gdk_display_pointer_ungrab+0xba) [0x949f54]
#5 /usr/lib/libgdk-x11-2.0.so.0(gdk_pointer_ungrab+0x1c) [0x920dd9]
#6 /usr/lib/gtk-2.0/modules/libgnomebreakpad.so [0x37236e]
#7 /usr/lib/gtk-2.0/modules/libgnomebreakpad.so(_ZN15google_breakpad16ExceptionHandler21InternalWriteMinidumpEijPP10sigcontext+0x43) [0x372893]
#8 /usr/lib/gtk-2.0/modules/libgnomebreakpad.so(_ZN15google_breakpad16ExceptionHandler15HandleExceptionEi+0xa3) [0x372e23]
#9 [0x110400]
#10 /lib/libc.so.6(abort+0x188) [0x15d028]
#11 /lib/libc.so.6(__assert_fail+0xee) [0x15457e]
#12 /usr/lib/libX11.so.6 [0x73b2f14]
#13 /usr/lib/libX11.so.6(_XSend+0x63) [0x73b42f3]
#14 /usr/lib/libX11.so.6(_XFlush+0x32) [0x73b44b2]
#15 /usr/lib/libX11.so.6(XFlush+0x31) [0x738bb41]
#16 /usr/lib/libgdk-x11-2.0.so.0(gdk_display_flush+0xa0) [0x94a384]
#17 /usr/lib/libgdk-x11-2.0.so.0 [0x94112c]
#18 /usr/lib/libgdk-x11-2.0.so.0(gdk_window_process_all_updates+0xf8) [0x941244]
#19 /usr/lib/libgdk-x11-2.0.so.0 [0x940e94]
Collection: xcb_lock.c:77: _XGetXCBBuffer: Assertion `((int) ((xcb_req) - (dpy->request)) >= 0)' failed.
any idea why this is happening
thanks in advance
Mohith
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]