path: root/src/corelib/tools
diff options
authorMarc Mutz <>2015-02-21 09:59:22 +0100
committerMarc Mutz <>2015-03-13 11:37:36 +0000
commitd2f418e98f81da5130a69e6662a3968e63e5f077 (patch)
tree4bb7c98f2b08dd4fd42372fe29eebbd4fd15e3b9 /src/corelib/tools
parent4300f6e9ccf37c16ebde53e1c73cd8e8cfd2cd35 (diff)
QVector: remove brittle c2m() function
The c2m() function converts a const_iterator into an iterator, but is a broken concept for an implicitly shared container such as QVector, because the act of calling begin() as the starting point already detaches and invalidates the c2m argument. This could be fixed in c2m, but it's too easy for a caller to cause iterator invalidation even before calling c2m, as QTBUG-44592 showed, so remove the function completely. Task-number: QTBUG-44592 Change-Id: Ibde8cd1d78a412cc9fb621f743e52f74291aff4f Reviewed-by: Olivier Goffart (Woboq GmbH) <> Reviewed-by: Thiago Macieira <>
Diffstat (limited to 'src/corelib/tools')
1 files changed, 0 insertions, 1 deletions
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index 9d5b749e79..a48269cfaa 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -265,7 +265,6 @@ private:
return (i <= d->end()) && (d->begin() <= i);
- iterator c2m(const_iterator it) { return begin() + (it - cbegin()); }
class AlignmentDummy { Data header; T array[1]; };