Wrong usage of QList::ConstIterator & QList::begin() ?
Ch.Ehrlicher at gmx.de
Sat Oct 18 10:45:06 BST 2008
While trying to fix some bugs in KFile* on windows I saw some places
for ( QStringList::ConstIterator it = m_dirList.begin();
it != m_dirList.end() && !terminationRequested();
Imo the programmer here expects that m_dirList.detach() isn't called but
this is wrong.
m_dirList.begin() does a detach, returns a non-const iterator and then
the iterator is converted to a const iterator (see qlist.h:214 & 238).
Therefore I suggest to add QT_STRICT_ITERATORS to the kdelibs flags. Or
does this maybe break BC?
More information about the kde-core-devel