diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-10-22 20:11:14 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-10-22 20:11:14 (GMT) |
commit | fa0359bbf8063c74827f1267e7b40dd56ce42ad6 (patch) | |
tree | 188285a588d7270e84277064f3e32be694e694a7 | |
parent | db14623485396fd69839e519184b794775b65b01 (diff) | |
parent | 3bb0cf4ad7166860fb7b81b1bbe1d84d86d4203c (diff) | |
download | Qt-fa0359bbf8063c74827f1267e7b40dd56ce42ad6.zip Qt-fa0359bbf8063c74827f1267e7b40dd56ce42ad6.tar.gz Qt-fa0359bbf8063c74827f1267e7b40dd56ce42ad6.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
-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) |