PDA

View Full Version : QObject's event method not being called



jkburges
4th September 2009, 03:22
Hi all,

I have a sub-class of QObject (let's call it MyObject) which overrides the event() method.

A thread, not on the QCoreApplication main thread, is creating events and posting, as in:



MyEvent *e = new MyEvent; // subclass of QEvent
QCoreApplication::postEvent(&MyObject, e);


Now, my problem is that there seems to be some sort of race condition, as sometimes my program runs and works fine, i.e. the event() method is called, allowing events to be processed by MyObject.

But on other occasions, the event() method is never being called.

Any ideas of where to go looking for this? Does it mean something else is blocking the main event loop?

Cheers,
Jono

wysota
4th September 2009, 09:02
We'd have to see more code. But there shouldn't be any race conditions - post event is thread safe.