summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/src/implicit-sharing.qdoc
diff options
context:
space:
mode:
authorThorbjørn Martsum <tmartsum@gmail.com>2013-09-24 16:42:22 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-15 12:10:01 +0200
commit499957eb8b1c5150823f05f40f32b04ba13b1640 (patch)
treee339c9fdf4d0121f175e35bed4883007190ed971 /src/corelib/doc/src/implicit-sharing.qdoc
parentcfb717d654b92dcfde94cddc7039abeafe67f289 (diff)
Improve implicit shared documentation a bit
Task-number: QTBUG-27061 Change-Id: I66e000a9f59fda3654066013e6e78c3ba6fd27fe Reviewed-by: Mitch Curtis <mitch.curtis@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/doc/src/implicit-sharing.qdoc')
-rw-r--r--src/corelib/doc/src/implicit-sharing.qdoc20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/corelib/doc/src/implicit-sharing.qdoc b/src/corelib/doc/src/implicit-sharing.qdoc
index 814f8140f3..1185fe8348 100644
--- a/src/corelib/doc/src/implicit-sharing.qdoc
+++ b/src/corelib/doc/src/implicit-sharing.qdoc
@@ -89,9 +89,12 @@
of data. Objects can easily be assigned, sent as function arguments,
and returned from functions.
- Implicit sharing takes place behind the scenes; the programmer
- does not need to worry about it. Even in multithreaded
- applications, implicit sharing takes place, as explained in
+ Implicit sharing mostly takes place behind the scenes;
+ the programmer rarely needs to worry about it. However, Qt's
+ container iterators have different behavior than those from
+ the STL. Read \l{Implicit sharing iterator problem}.
+
+ In multithreaded applications, implicit sharing takes place, as explained in
\l{Thread-Support in Qt Modules#Threads and Implicitly Shared Classes}
{Threads and Implicitly Shared Classes}.
@@ -105,9 +108,10 @@
greater than one. (This is often called \e {copy-on-write} or
\e {value semantics}.)
- An implicitly shared class has total control of its internal data. In
+ An implicitly shared class has control of its internal data. In
any member functions that modify its data, it automatically detaches
- before modifying the data.
+ before modifying the data. Notice, however, the special case with
+ container iterators; see \l{Implicit sharing iterator problem}.
The QPen class, which uses implicit sharing, detaches from the shared
data in all member functions that change the internal data.
@@ -133,9 +137,9 @@
In this example, \c p1 and \c p2 share data until QPainter::begin()
is called for \c p2, because painting a pixmap will modify it.
- \warning Do not copy an implicitly shared container (QMap,
- QVector, etc.) while you are iterating over it using an non-const
- \l{STL-style iterators}{STL-style iterator}.
+ \warning Be careful with copying an implicitly shared container
+ (QMap, QVector, etc.) while you use
+ \l{STL-style iterators}{STL-style iterator}. See \l{Implicit sharing iterator problem}.
\keyword implicitly shared classes
\annotatedlist shared