diff options
author | Jason Barron <jbarron@trolltech.com> | 2009-08-20 15:50:20 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2009-08-20 15:50:20 (GMT) |
commit | 79a5babcd2fdee3aca7fb6b13d9eddd2ec130581 (patch) | |
tree | 48146ff0a0dc09ad80b317df83e3ec646c229aa3 /src/corelib | |
parent | e93ffdbb6fde611defc34fd27aec25c40da5a60e (diff) | |
parent | 63a6395e6bd24a3bd11425c6a978a111f53ebf99 (diff) | |
download | Qt-79a5babcd2fdee3aca7fb6b13d9eddd2ec130581.zip Qt-79a5babcd2fdee3aca7fb6b13d9eddd2ec130581.tar.gz Qt-79a5babcd2fdee3aca7fb6b13d9eddd2ec130581.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt-s60-public
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/global/qglobal.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qdatetime.cpp | 5 | ||||
-rw-r--r-- | src/corelib/tools/qdatetime.h | 4 | ||||
-rw-r--r-- | src/corelib/tools/qdatetime_p.h | 4 | ||||
-rw-r--r-- | src/corelib/tools/qshareddata.h | 4 | ||||
-rw-r--r-- | src/corelib/tools/qsharedpointer_impl.h | 2 |
6 files changed, 13 insertions, 8 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 6722418..7dbbc1b 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2026,7 +2026,7 @@ inline void qSwap(T &value1, T &value2) template <> inline bool qIsDetached<TYPE>(TYPE &t) { return t.isDetached(); } \ template <> inline void qSwap<TYPE>(TYPE &value1, TYPE &value2) \ { \ - qSwap<TYPE::DataPtr>(value1.data_ptr(), value2.data_ptr()); \ + qSwap(value1.data_ptr(), value2.data_ptr()); \ } /* diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 8b9d202..ecb0bcb 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -2231,9 +2231,8 @@ QDateTime::QDateTime(const QDate &date, const QTime &time, Qt::TimeSpec spec) */ QDateTime::QDateTime(const QDateTime &other) - : d(other.d.data()) + : d(other.d) { - d->ref.ref(); } /*! @@ -2250,7 +2249,7 @@ QDateTime::~QDateTime() QDateTime &QDateTime::operator=(const QDateTime &other) { - d.assign(other.d.data()); + d = other.d; return *this; } diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index 84d3e83..988d1a2 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -44,7 +44,7 @@ #include <QtCore/qstring.h> #include <QtCore/qnamespace.h> -#include <QtCore/qscopedpointer.h> +#include <QtCore/qsharedpointer.h> QT_BEGIN_HEADER @@ -285,7 +285,7 @@ public: private: friend class QDateTimePrivate; void detach(); - QScopedSharedPointer<QDateTimePrivate> d; + QExplicitlySharedDataPointer<QDateTimePrivate> d; #ifndef QT_NO_DATASTREAM friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QDateTime &); diff --git a/src/corelib/tools/qdatetime_p.h b/src/corelib/tools/qdatetime_p.h index 0284ed1..227e4fb 100644 --- a/src/corelib/tools/qdatetime_p.h +++ b/src/corelib/tools/qdatetime_p.h @@ -81,9 +81,9 @@ class QDateTimePrivate public: enum Spec { LocalUnknown = -1, LocalStandard = 0, LocalDST = 1, UTC = 2, OffsetFromUTC = 3}; - QDateTimePrivate() : ref(1), spec(LocalUnknown), utcOffset(0) {} + QDateTimePrivate() : spec(LocalUnknown), utcOffset(0) {} QDateTimePrivate(const QDateTimePrivate &other) - : ref(1), date(other.date), time(other.time), spec(other.spec), utcOffset(other.utcOffset) + : date(other.date), time(other.time), spec(other.spec), utcOffset(other.utcOffset) {} QAtomicInt ref; diff --git a/src/corelib/tools/qshareddata.h b/src/corelib/tools/qshareddata.h index dde6e88..8aace0f 100644 --- a/src/corelib/tools/qshareddata.h +++ b/src/corelib/tools/qshareddata.h @@ -69,6 +69,9 @@ private: template <class T> class QSharedDataPointer { public: + typedef T Type; + typedef T *pointer; + inline void detach() { if (d && d->ref != 1) detach_helper(); } inline T &operator*() { detach(); return *d; } inline const T &operator*() const { return *d; } @@ -127,6 +130,7 @@ template <class T> class QExplicitlySharedDataPointer { public: typedef T Type; + typedef T *pointer; inline T &operator*() const { return *d; } inline T *operator->() { return d; } diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index bce4c64..90ca34f 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -555,10 +555,12 @@ public: inline QWeakPointer() : d(0), value(0) { } inline ~QWeakPointer() { if (d && !d->weakref.deref()) delete d; } +#ifndef QT_NO_QOBJECT // special constructor that is enabled only if X derives from QObject template <class X> inline QWeakPointer(X *ptr) : d(ptr ? d->getAndRef(ptr) : 0), value(ptr) { } +#endif template <class X> inline QWeakPointer &operator=(X *ptr) { return *this = QWeakPointer(ptr); } |