Name threads properly

When there is no QObject subclass with Q_OBJECT macro,
we must at least set an object name

Change-Id: Ib429a9b246d9d6b4b4cfb11593e4f358850677f2
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
mae 2012-03-01 19:42:50 +01:00 committed by Qt by Nokia
parent 9c757fac35
commit 0f49137027
2 changed files with 4 additions and 0 deletions

View File

@ -607,12 +607,14 @@ void QNetworkReplyHttpImplPrivate::postRequest()
if (synchronous) { if (synchronous) {
// A synchronous HTTP request uses its own thread // A synchronous HTTP request uses its own thread
thread = new QThread(); thread = new QThread();
thread->setObjectName(QStringLiteral("httpReply"));
QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
thread->start(); thread->start();
} else if (!managerPrivate->httpThread) { } else if (!managerPrivate->httpThread) {
// We use the manager-global thread. // We use the manager-global thread.
// At some point we could switch to having multiple threads if it makes sense. // At some point we could switch to having multiple threads if it makes sense.
managerPrivate->httpThread = new QThread(); managerPrivate->httpThread = new QThread();
managerPrivate->httpThread->setObjectName(QStringLiteral("httpThread"));
QObject::connect(managerPrivate->httpThread, SIGNAL(finished()), managerPrivate->httpThread, SLOT(deleteLater())); QObject::connect(managerPrivate->httpThread, SIGNAL(finished()), managerPrivate->httpThread, SLOT(deleteLater()));
managerPrivate->httpThread->start(); managerPrivate->httpThread->start();

View File

@ -70,6 +70,8 @@ void QNetworkConfigurationManagerPrivate::initialize()
{ {
//Two stage construction, because we only want to do this heavyweight work for the winner of the Q_GLOBAL_STATIC race. //Two stage construction, because we only want to do this heavyweight work for the winner of the Q_GLOBAL_STATIC race.
bearerThread = new QThread(); bearerThread = new QThread();
bearerThread->setObjectName(QStringLiteral("bearerThread"));
bearerThread->moveToThread(QCoreApplicationPrivate::mainThread()); // because cleanup() is called in main thread context. bearerThread->moveToThread(QCoreApplicationPrivate::mainThread()); // because cleanup() is called in main thread context.
moveToThread(bearerThread); moveToThread(bearerThread);
bearerThread->start(); bearerThread->start();