
Originally Posted by
anda_skoa
you would have the thread access a destroyed object._
you are referring to below function I think & myData obj; is a class member in my actual code & It never gets destructed before thread finishes. again this is due to writing some code on fly sorry for that.
void myclass::startThread()
{
myData obj; //this is class member in actual code & never gets destructed before thread finishes, I just wanted to show the reference variable problem here so I just didn't care this
emit startMyThread(obj);
}
void myclass::startThread()
{
myData obj; //this is class member in actual code & never gets destructed before thread finishes, I just wanted to show the reference variable problem here so I just didn't care this
emit startMyThread(obj);
}
To copy to clipboard, switch view to plain text mode

Originally Posted by
anda_skoa
Passing a reference is possible, just not via a queued connection._
So what connect should I use, Direct connection making slot to execute in main thread. I think other connections more or less same as these 2 connections except unique connection.

Originally Posted by
anda_skoa
What feature?
To store a reference like a pointer? That you would have to take up with the C++ standard comittee._
passing reference to thread when It is queued connection if there is no other way.
Bookmarks