Thread
:
"QObject: Cannot create children for a parent that is in a different thread."
View Single Post
cjard
2010-03-13 , 09:44
Posts: 225 | Thanked: 64 times | Joined on Feb 2010
#
1
Hi all
Having raided the Threaded Fortune Server example, theres a section of code I copied from it that causes this message to print out in the console. I've subclasses thread to create a worker that will read and write the socket, and passed the socket descriptor to the workerthread's constructor.
In the workerthread's run method I call:
tcpSocket.setSocketDescriptor(theSocketDescriptor)
where the int passed in is the socket descriptor, got from the listening socket.
This in turn calls trolltech's code:
d->socketEngine = QAbstractSocketEngine::createSocketEngine(socketDe scriptor, this);
where "this" is the abstract socket itself.
I'm thinking that instead of passing the socketDescriptor to the worker and letting it set the socket up itself, I should set the socketDescriptor from the thread that creates the worker? Is this how I get this message to go away?
Quote & Reply
|
cjard
View Public Profile
Send a private message to cjard
Find all posts by cjard