From 61bd72461b2f02bdcd316b32de7749eca8692212 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 24 May 2010 15:31:15 +1000 Subject: Do not attempt to setParent of object in a different thread QNetworkAccessManager::setCookieJar used to give an error message, now it documents the behavior and avoids the warning. Task-number: QTBUG-10554 --- src/network/access/qnetworkaccessmanager.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 1c7661d..b7539da 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -595,8 +595,9 @@ QNetworkCookieJar *QNetworkAccessManager::cookieJar() const \note QNetworkAccessManager takes ownership of the \a cookieJar object. - QNetworkAccessManager will set the parent of the \a cookieJar - passed to itself, so that the cookie jar is deleted when this + If \a cookieJar is in the same thread as this QNetworkAccessManager, + it will set the parent of the \a cookieJar + so that the cookie jar is deleted when this object is deleted as well. If you want to share cookie jars between different QNetworkAccessManager objects, you may want to set the cookie jar's parent to 0 after calling this function. @@ -621,7 +622,8 @@ void QNetworkAccessManager::setCookieJar(QNetworkCookieJar *cookieJar) if (d->cookieJar && d->cookieJar->parent() == this) delete d->cookieJar; d->cookieJar = cookieJar; - d->cookieJar->setParent(this); + if (thread() == cookieJar->thread()) + d->cookieJar->setParent(this); } } -- cgit v0.12