don't detach until the list is going to be modified

removeAt() does detach()'ing for us

Merge-request: 1285
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>

(cherry picked from commit 52223d80ec8ba6d579c091efe0e40589a5d2bd67)

Change-Id: I78865e19f989d9079c8dee47b8cf1bdf7e5db261
Reviewed-on: http://codereview.qt-project.org/4578
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
Ritt Konstantin 2011-07-13 18:14:39 +02:00 committed by Qt by Nokia
parent 9f865df5d1
commit b206ae41b2

View File

@ -776,7 +776,6 @@ Q_OUTOFLINE_TEMPLATE int QList<T>::removeAll(const T &_t)
template <typename T>
Q_OUTOFLINE_TEMPLATE bool QList<T>::removeOne(const T &_t)
{
detachShared();
int index = indexOf(_t);
if (index != -1) {
removeAt(index);