Skip to content

Warning 'QWaitCondition: Destroyed while threads are still waiting' at test app exit #418

@amiart

Description

@amiart

I created my own test that use TF_TEST_SQL_MAIN() macro:

TF_TEST_SQL_MAIN(MyTestApp, true)

In the test I use QNetworkAccessManager to send POST request to a remote server:

QNetworkAccessManager networkAccessManager;
QNetworkRequest request(url);
request.setHeader(QNetworkRequest::ContentTypeHeader, QByteArrayLiteral("application/x-www-form-urlencoded"));
QNetworkReply *reply = networkManager.post(request, args);

QEventLoop eventLoop;
QObject::connect(reply, SIGNAL(finished()), &eventLoop, SLOT(quit()));
eventLoop.exec();

// process reply ...

delete reply;

Everything works fine, but I get 'QWaitCondition: Destroyed while threads are still waiting' at the app exit.

After investigation it turned out that the problem was '_exit(thread.returnCode)' call in TF_TEST_SQL_MAIN().
The destructor of TWebApplication is not called and some of the threads are still running in background.

Is it safe to remove _exit(thread.returnCode) without breaking treefrog tests ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions