Hello; I'm writing a Gui that use lib callbacks where I have no control of them. I have created a class that inherits from QWidget and
library listener so when something happens, this function is called by the library:
Code:
{ { Library::getIstance()->addListener(this); // add the listener } } void MyClass::on(Listener::listener, Object *o) { emit signal(o); }
Library lives in own thread and it usually starts others. I know Qt complains if the sender's and receiver's thread ae different. Infact
application is killed with the following error:
It usually works and it usually don't. Why doesn't this problem happen always?Quote:
ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread. Current thread 2aaaac07be40.
Receiver 'updateButton' (of type 'QPushButton') was created in thread 6a9db0", file kernel/qcoreapplication.cpp, line 274
I think I should create a new class that inherits from QThread and this class through queued signals handles lib thread. Am I wrong?
Thank your your answer ;)