[Qt-interest] cannot send posted events for objects in another thread

Marco Borm qt-lists at retrodesignfan.eu
Wed Apr 15 00:09:15 CEST 2009


http://doc.trolltech.com/4.5/threads.html
"In GUI applications, the main thread is also called the GUI thread 
because it's the only thread that is allowed to perform GUI-related 
operations."

So calling show() in the run-function of the thread isn't allowed.

Marco

Yifei Li wrote:
> Hi all,
>
> [...]
> I have a global object of Foo  and all the work is done in Foo:doWork, 
> Foo has a signal telling us its progress.  Then in WorkerThread::run(),  
> Foo::doWork is called.  I connet Foo's signal to a slot in WorkerThread, 
> and in the slot I updated the value of a progress dialog.
>
> [...]
>
> QCoreApplication::sendPostedEvents: Cannot send posted events for 
> objects in another thread
> ( the above message is repeated here)
> MyApp: xcb_lock.c:77: _XGetXCBBuffer: Assertion `((int) ((xcb_req) - 
> (dpy->request)) >= 0)' failed.
>
> [...]
> void WorkerThread::run()
> {
>     pd->show();
>     foo.doWork();      // do the work
> }
>
>   




More information about the Qt-interest-old mailing list