diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 08dedb4e94..798351cd61 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -419,13 +419,8 @@ template Q_INLINE_TEMPLATE QList &QList::operator=(const QList &l) { if (d != l.d) { - QListData::Data *o = l.d; - o->ref.ref(); - if (!d->ref.deref()) - dealloc(d); - d = o; - if (!d->sharable) - detach_helper(); + QList tmp(l); + tmp.swap(*this); } return *this; }