summaryrefslogtreecommitdiffstats
path: root/src/network/access
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-05-24 05:31:15 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-05-24 05:31:15 (GMT)
commit61bd72461b2f02bdcd316b32de7749eca8692212 (patch)
treeaeb01965fc73515b67ea3e68b7111b7de082e58f /src/network/access
parent79446ca4e047e68bea68aef902a5d48478bcc9cc (diff)
downloadQt-61bd72461b2f02bdcd316b32de7749eca8692212.zip
Qt-61bd72461b2f02bdcd316b32de7749eca8692212.tar.gz
Qt-61bd72461b2f02bdcd316b32de7749eca8692212.tar.bz2
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
Diffstat (limited to 'src/network/access')
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp8
1 files 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);
}
}