diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-10-23 06:03:30 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-10-23 06:03:30 (GMT) |
commit | 0e35dfc313523d42ad9a4fdaf6e33729562cd033 (patch) | |
tree | 05d6298f3634496ed32ddeec9d3f7a143777fc47 /src/corelib | |
parent | bb2b9362ced23ff2aae824ef001efe7a34b464cc (diff) | |
parent | fa0359bbf8063c74827f1267e7b40dd56ce42ad6 (diff) | |
download | Qt-0e35dfc313523d42ad9a4fdaf6e33729562cd033.zip Qt-0e35dfc313523d42ad9a4fdaf6e33729562cd033.tar.gz Qt-0e35dfc313523d42ad9a4fdaf6e33729562cd033.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1:
Fix access to uninitialised memory in case of new throwing
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/tools/qsharedpointer_impl.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 4cce339..2519a22 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -378,6 +378,13 @@ namespace QtSharedPointer { inline ExternalRefCount() : d(0) { } inline ExternalRefCount(Qt::Initialization i) : Basic<T>(i) { } + + inline ExternalRefCount(T *ptr) : Basic<T>(Qt::Uninitialized) // throws + { internalConstruct(ptr); } + template <typename Deleter> + inline ExternalRefCount(T *ptr, Deleter d) : Basic<T>(Qt::Uninitialized) // throws + { internalConstruct(ptr, d); } + inline ExternalRefCount(const ExternalRefCount<T> &other) : Basic<T>(other), d(other.d) { if (d) ref(); } template <class X> @@ -448,11 +455,12 @@ public: inline QSharedPointer() { } // inline ~QSharedPointer() { } - inline explicit QSharedPointer(T *ptr) : BaseClass(Qt::Uninitialized) - { BaseClass::internalConstruct(ptr); } + inline explicit QSharedPointer(T *ptr) : BaseClass(ptr) // throws + { } template <typename Deleter> - inline QSharedPointer(T *ptr, Deleter d) { BaseClass::internalConstruct(ptr, d); } + inline QSharedPointer(T *ptr, Deleter d) : BaseClass(ptr, d) // throws + { } inline QSharedPointer(const QSharedPointer<T> &other) : BaseClass(other) { } inline QSharedPointer<T> &operator=(const QSharedPointer<T> &other) |