Important: Please read the Qt Code of Conduct -

[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);

        cout << fc.getPercentComplete() << endl;
        cout << "copy failed" << endl;@

Log in to reply