Hi
I'm having some problems with the QObject::setParent() function across threads. I'm seeing this behavior on windows only. On mac it works fine. Qt 4.6.2 in used on both platforms.
Here is the code:
Qt Code:
MyObject *object = new MyObject(); if (parent) { if (parent->thread() != object->thread()) { object->moveToThread(parent->thread()); } Q_ASSERT(parent->thread() == object->thread()); object->setParent(parent); }To copy to clipboard, switch view to plain text mode
The error message is as follows:
Cannot send events to objects owned by a different thread. Current thread 588d088. Receiver 'MyObject' (of type 'MyObject') was created in thread a4f690
What could be wrong?
Bookmarks