diff -rupN /qt-everywhere-opensource-src-5.0.1-pristine/qtbase/src/corelib/tools/qlist.h /qt-everywhere-opensource-src-5.0.1/qtbase/src/corelib/tools/qlist.h --- /qt-everywhere-opensource-src-5.0.1-pristine/qtbase/src/corelib/tools/qlist.h 2013-01-29 11:03:01.000000000 -0800 +++ /qt-everywhere-opensource-src-5.0.1/qtbase/src/corelib/tools/qlist.h 2013-03-13 14:35:17.945065800 -0700 @@ -359,8 +359,15 @@ Q_INLINE_TEMPLATE T &QList::Node::t() template Q_INLINE_TEMPLATE void QList::node_construct(Node *n, const T &t) { - if (QTypeInfo::isLarge || QTypeInfo::isStatic) n->v = new T(t); - else if (QTypeInfo::isComplex) new (n) T(t); + if (QTypeInfo::isLarge || QTypeInfo::isStatic) + { + void *memory = qMallocAligned(sizeof(T), 16); + n->v = new (memory) T(t); + } + else if (QTypeInfo::isComplex) + { + new (n) T(t); + } #if (defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__IBMCPP__)) && !defined(__OPTIMIZE__) // This violates pointer aliasing rules, but it is known to be safe (and silent) // in unoptimized GCC builds (-fno-strict-aliasing). The other compilers which @@ -375,8 +382,12 @@ Q_INLINE_TEMPLATE void QList::node_co template Q_INLINE_TEMPLATE void QList::node_destruct(Node *n) { - if (QTypeInfo::isLarge || QTypeInfo::isStatic) delete reinterpret_cast(n->v); - else if (QTypeInfo::isComplex) reinterpret_cast(n)->~T(); + if (QTypeInfo::isLarge || QTypeInfo::isStatic) + { + reinterpret_cast(n->v)->~T(); + qFreeAligned(n->v); + } + else if (QTypeInfo::isComplex) reinterpret_cast(n)->~T(); } template @@ -385,14 +396,20 @@ Q_INLINE_TEMPLATE void QList::node_co Node *current = from; if (QTypeInfo::isLarge || QTypeInfo::isStatic) { QT_TRY { - while(current != to) { - current->v = new T(*reinterpret_cast(src->v)); + while(current != to) + { + void *memory = qMallocAligned(sizeof(T), 16); + + current->v = new (memory) T(*reinterpret_cast(src->v)); ++current; ++src; } } QT_CATCH(...) { while (current-- != from) - delete reinterpret_cast(current->v); + { + reinterpret_cast(current->v)->~T(); + qFreeAligned(current->v); + } QT_RETHROW; } @@ -418,7 +435,14 @@ template Q_INLINE_TEMPLATE void QList::node_destruct(Node *from, Node *to) { if (QTypeInfo::isLarge || QTypeInfo::isStatic) - while(from != to) --to, delete reinterpret_cast(to->v); + { + while(from != to) + { + --to; + reinterpret_cast(to->v)->~T(); + qFreeAligned(to->v); + } + } else if (QTypeInfo::isComplex) while (from != to) --to, reinterpret_cast(to)->~T(); }