diff options
author | Richard Browne <richb@richb.net> | 2013-07-09 21:07:29 +1000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-30 01:14:16 +0200 |
commit | 9f8a724cda6783ca275fb810e7d1fc05bf840e2e (patch) | |
tree | d6ba73aa7d55919a5ccf7b6c04f98c720f642943 /src/corelib | |
parent | 6c21f42657b494e24112c90d8b9fff719f1f8791 (diff) |
Work around msvc /clr LNK2005 errors with QList
This patch fixes a compatibility with Qt 5 and Microsoft C++ /clr mode.
The QList copy constructor defines a Cleanup class that causes LNK2005
errors. It is a compiler problem, but the patch is simple. The use of
QT_TRY/QT_RETHROW instead of a Cleanup class is more consistent with other
Qt code, so is arguably preferable even without the compiler bug.
Task-number: QTBUG-31949
Change-Id: I1acfbae1924f0a52ffb8d9722b52e01b61edd42e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/tools/qlist.h | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 0592c24e9f..72e1403e76 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -715,18 +715,14 @@ Q_OUTOFLINE_TEMPLATE QList<T>::QList(const QList<T> &l) if (!d->ref.ref()) { p.detach(d->alloc); - struct Cleanup - { - Cleanup(QListData::Data *d) : d_(d) {} - ~Cleanup() { if (d_) QListData::dispose(d_); } - - QListData::Data *d_; - } tryCatch(d); - - node_copy(reinterpret_cast<Node *>(p.begin()), - reinterpret_cast<Node *>(p.end()), - reinterpret_cast<Node *>(l.p.begin())); - tryCatch.d_ = 0; + QT_TRY { + node_copy(reinterpret_cast<Node *>(p.begin()), + reinterpret_cast<Node *>(p.end()), + reinterpret_cast<Node *>(l.p.begin())); + } QT_CATCH(...) { + QListData::dispose(d); + QT_RETHROW; + } } } |