[Solved] QtConcurrent::run() and QWaitCondition destroyed messages
-
Edit: I didn't have a QCoreApplication defined in main(). Added that, no more thread messages.
I'm trying to run a function of a class using the QtConcurrent::run() method. The thread runs and does exactly what it should. However, when the thread ends, I get this error message in the console:
@QWaitCondition: Destroyed while threads are still waiting@What's the correct way to use QtConcurrent::run() so that no unsightly error messages pop up?
Here is the code in question (getPercentComplete() doesn't modify any data):
@ bool (FileCopier::*async_copy)(void);
async_copy = &FileCopier::copy;
QFuture<bool> thread = QtConcurrent::run(&fc, async_copy);while(thread.isRunning()) { cout << fc.getPercentComplete() << endl; } if(!thread.result()) cout << "copy failed" << endl;@