diff options
author | Thorbjørn Martsum <tmartsum@gmail.com> | 2013-06-17 11:35:46 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-24 15:36:30 +0200 |
commit | c35b55f076baf8cfd62549e8e386bfd95853de69 (patch) | |
tree | e371b4e9d05bc3ad4a86f6563605e25f4f8224ee /src/corelib/tools/qlinkedlist.h | |
parent | 97f867212f1e6944152c3560b2edb9b8d430847b (diff) |
QLinkedList - fix insert with iterator when the list is shared.
Before a call to erase on a shared instance would imply that the
item was inserted into the shared data (i.e all instances)
Change-Id: I655ccf04b1ad9bf82e6bfade58929538fa7df000
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qlinkedlist.h')
-rw-r--r-- | src/corelib/tools/qlinkedlist.h | 3 |
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; |