Hi,
I’m a bit confused as to how I’m supposed to used invokeMethod, which I understand is the best way to exchange data across threads if I don’t want to use a signal/slot. However, I keep getting a memory access violation.
Am I doing this the right way, or am I missing something?
This is the method I’m using to get data from my other object, ClassTwo
void ClassOne::lookAtSomeStuff()
{
QList<QUrl>* list;
QMetaObject::invokeMethod(myClassTwoObject, "getStuff", Qt::DirectConnection, Q_RETURN_ARG(QList<QUrl>*, list));
QList<QUrl>::const_iterator i = list->begin();
for (i; i != list->end(); ++i)
{
QUrl url = QUrl((*i).url()); //this is the line that throws the exception
doSomething(url);
}
}
And here is my ClassTwo, which runs in a separate thread:
QList<QUrl>* ClassTwo::getStuff() {
return this->myStuff;
}
I can confirm that the object in ClassTwo is not null (actually has ~20 items). Am I missing something really obvious?
↧