diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-07-17 23:46:45 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-07-17 23:46:45 (GMT) |
commit | 53d3083eecf88a20bc36ada43942c7a18677af62 (patch) | |
tree | 19116918f6aa138197831c2cb86e1adcce120dea /src/corelib/tools | |
parent | d61c74faef2ed787aacc53c03b8361fa57bccc8e (diff) | |
parent | 15efa03d234aa51b0c24c68c18a98dce0d66bdff (diff) | |
download | Qt-53d3083eecf88a20bc36ada43942c7a18677af62.zip Qt-53d3083eecf88a20bc36ada43942c7a18677af62.tar.gz Qt-53d3083eecf88a20bc36ada43942c7a18677af62.tar.bz2 |
Merge branch 'qt-4.7-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration into 4.7-integration
* 'qt-4.7-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration: (50 commits)
Fix compilation after merge
Fixed some network tests never being run.
Remove test cases which cause stack overflow
Avoid a crash in the OpenVG paint engine when clipping to an empty path
Fix last character being overwritten in password field
Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( 038b62085831eef4dee423361c65ecd55b7b9b1d )
QSslSocket: Improve error handling
Compile when bootstrapping qmake
Fix regression in tst_qrand::testqrand()
syncqt: don't try to split %module's values
syncqt: fix wrong paths in include/ActiveQt/headers.pri
Fix a crash when recursing into QSharedPointer from QSharedPointer::clear()
Fix a couple of memory leaks due to not releasing CFTypes on Mac
Initalize the nativeDialogInUse variable
The Q_WGL define was removed years ago.
Compile
QUUid::createUuid() should not generate identical sequences on UNIX
typos fixed
Use lower case for including system header files
Added trace statements to Phonon MMF backend
...
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qsharedpointer_impl.h | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 550ff58..4cce339 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -324,12 +324,17 @@ namespace QtSharedPointer { typedef ExternalRefCountData Data; inline void ref() const { d->weakref.ref(); d->strongref.ref(); } - inline bool deref() + inline void deref() + { deref(d, this->value); } + static inline void deref(Data *d, T *value) { + if (!d) return; if (!d->strongref.deref()) { - internalDestroy(); + if (!d->destroy()) + delete value; } - return d->weakref.deref(); + if (!d->weakref.deref()) + delete d; } inline void internalConstruct(T *ptr) @@ -378,7 +383,7 @@ namespace QtSharedPointer { template <class X> inline ExternalRefCount(const ExternalRefCount<X> &other) : Basic<T>(other.value), d(other.d) { if (d) ref(); } - inline ~ExternalRefCount() { if (d && !deref()) delete d; } + inline ~ExternalRefCount() { deref(); } template <class X> inline void internalCopy(const ExternalRefCount<X> &other) @@ -386,12 +391,6 @@ namespace QtSharedPointer { internalSet(other.d, other.data()); } - inline void internalDestroy() - { - if (!d->destroy()) - delete this->value; - } - inline void internalSwap(ExternalRefCount &other) { qSwap(d, other.d); @@ -424,10 +423,14 @@ namespace QtSharedPointer { else o = 0; } - if (d && !deref()) - delete d; - d = o; - this->value = d && d->strongref ? actual : 0; + + qSwap(d, o); + qSwap(this->value, actual); + if (!d || d->strongref == 0) + this->value = 0; + + // dereference saved data + deref(o, actual); } Data *d; |