diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-08-21 18:11:14 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-08-21 18:11:14 (GMT) |
commit | 7a7ea0219f6ebb9f7833649ec76e077796be1843 (patch) | |
tree | 6384967dbedb10aa71aa6978f53a24db71fa314b /src/corelib | |
parent | c302d6206dfc6169abdc524c5729dd4065b0e27c (diff) | |
download | Qt-7a7ea0219f6ebb9f7833649ec76e077796be1843.zip Qt-7a7ea0219f6ebb9f7833649ec76e077796be1843.tar.gz Qt-7a7ea0219f6ebb9f7833649ec76e077796be1843.tar.bz2 |
Fix trivial QList detaching: QListData::detach2() *must* memcpy.
Qt 4.5 did that and the node_copy function depended on it. I have some
patches from Lars that introduce detach3() and try to improve
performance a bit more.
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/tools/qlist.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp index d954160..58406b9 100644 --- a/src/corelib/tools/qlist.cpp +++ b/src/corelib/tools/qlist.cpp @@ -94,7 +94,6 @@ QListData::Data *QListData::detach() /*! * Detaches the QListData by reallocating new memory. * Returns the old (shared) data, it is up to the caller to deref() and free() - * For the new data node_copy needs to be called. * * \internal */ @@ -104,6 +103,7 @@ QListData::Data *QListData::detach2() Data* t = static_cast<Data *>(qMalloc(DataHeaderSize + x->alloc * sizeof(void *))); Q_CHECK_PTR(t); + ::memcpy(t, x, DataHeaderSize + x->alloc * sizeof(void *)); t->ref = 1; t->sharable = true; t->alloc = x->alloc; |