PDA

View Full Version : probleme in multithreading and xcb in a Qt application



halmassi
7th February 2010, 15:39
i have trouble to run my application
where i have a MainWindow to display pictures
i have 2 threads : one to get the pictures and the other to display it
i display the pictures using a QPainter object and the methode drawimage()
when running, i have this error message:

xcb_lock.c*:33*:*_XCBUnlockDisplay: assertion «*xcb_get_request_sent(dpy->xcb->connection) == dpy->request*» failed.
the backtrace of the main thread and the thread dispalying pictures are the following:



Thread 1 (Thread 0xb6cc46d0 (LWP 11980)):
#0 0xffffe430 in __kernel_vsyscall ()
#1 0xb6d4f900 in raise () from /lib/libc.so.6
#2 0xb6d51238 in abort () from /lib/libc.so.6
#3 0xb6d4870e in __assert_fail () from /lib/libc.so.6
#4 0xb729880e in ?? () from /usr/lib/libX11.so.6
#5 0xb7281aaa in XEventsQueued () from /usr/lib/libX11.so.6
---Type <return> to continue, or q <return> to quit---
#6 0xb764341b in ?? () from /usr/lib/libQtGui.so.4
#7 0xb71b42ca in QEventLoop::processEvents () from /usr/lib/libQtCore.so.4
#8 0xb71b448a in QEventLoop::exec () from /usr/lib/libQtCore.so.4
#9 0xb71b666d in QCoreApplication::exec () from /usr/lib/libQtCore.so.4
#10 0xb75b8d47 in QApplication::exec () from /usr/lib/libQtGui.so.4
#11 0x0804f9ab in main ()

Thread 5 (Thread 0xb66c4b90 (LWP 12007)):
#0 0xffffe430 in __kernel_vsyscall ()
#1 0xb7fecc15 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2 0xb6ce50ff in _xcb_lock_io () from /usr/lib/libxcb.so.1
#3 0xb6cf66d2 in xcb_xlib_lock () from /usr/lib/libxcb-xlib.so.0
#4 0xb7298879 in ?? () from /usr/lib/libX11.so.6
#5 0xb72731b6 in XFreeGC () from /usr/lib/libX11.so.6
---Type <return> to continue, or q <return> to quit---
#6 0xb7678abe in ?? () from /usr/lib/libQtGui.so.4
#7 0xb7678cb2 in ?? () from /usr/lib/libQtGui.so.4
#8 0xb766b9da in QPixmap::fromImage () from /usr/lib/libQtGui.so.4
#9 0xb76a293c in QPaintEngine::drawImage () from /usr/lib/libQtGui.so.4
#10 0xb773c579 in ?? () from /usr/lib/libQtGui.so.4
#11 0xb76b150f in QPainter::drawImage () from /usr/lib/libQtGui.so.4
#12 0x0804fc13 in DrawPicture::paintEvent ()
#13 0xb760af61 in QWidget::event () from /usr/lib/libQtGui.so.4

franz
9th February 2010, 07:51
Make your code thread safe.

halmassi
11th February 2010, 10:35
Thanks, i have tried XInitThread(), and it works.