summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qurl.h
diff options
context:
space:
mode:
authorDavid Faure <faure@kde.org>2012-07-13 22:39:18 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-08-23 21:43:15 (GMT)
commitc3fe37fe18961d3ddb050fc788281eb79bc61d7a (patch)
treec5cb867c5f86b79f8fce7085110f5abd0f6b4736 /src/corelib/io/qurl.h
parent98ed9ba14a91c941d48cc5c946c4df1d7ed47945 (diff)
downloadQt-c3fe37fe18961d3ddb050fc788281eb79bc61d7a.zip
Qt-c3fe37fe18961d3ddb050fc788281eb79bc61d7a.tar.gz
Qt-c3fe37fe18961d3ddb050fc788281eb79bc61d7a.tar.bz2
QUrl: fix thread safety.
Developers expect const methods on the same QUrl instance to be usable from multiple threads (including copying and modifying the copy). The delayed parsing and internal cache of encoded strings break this, however (and the implicit sharing, for the case of copying). Protection with a mutex fixes this. Qt-5.0 doesn't have this issue, since QUrl doesn't do delayed parsing anymore. Change-Id: Ie2674e46eb7416b0e753323b673c10f9d3457f6d Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qurl.h')
-rw-r--r--src/corelib/io/qurl.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h
index 15d4174..d624418 100644
--- a/src/corelib/io/qurl.h
+++ b/src/corelib/io/qurl.h
@@ -56,6 +56,7 @@ QT_MODULE(Core)
class QUrlPrivate;
class QDataStream;
+class QMutexLocker;
class Q_CORE_EXPORT QUrl
{
@@ -274,6 +275,7 @@ protected:
#endif
private:
+ void detach(QMutexLocker &locker);
QUrlPrivate *d;
public:
typedef QUrlPrivate * DataPtr;