summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qlinkedlist.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qlinkedlist.h')
-rw-r--r--src/corelib/tools/qlinkedlist.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h
index 99be770ae9..572bdfba5d 100644
--- a/src/corelib/tools/qlinkedlist.h
+++ b/src/corelib/tools/qlinkedlist.h
@@ -453,6 +453,9 @@ int QLinkedList<T>::count(const T &t) const
template <typename T>
typename QLinkedList<T>::iterator QLinkedList<T>::insert(iterator before, const T &t)
{
+ if (d->ref.isShared())
+ before = detach_helper2(before);
+
Node *i = before.i;
Node *m = new Node(t);
m->n = i;