summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/global/qhooks.cpp2
-rw-r--r--src/corelib/time/qdatetime_p.h18
-rw-r--r--tests/auto/other/toolsupport/tst_toolsupport.cpp6
3 files changed, 9 insertions, 17 deletions
diff --git a/src/corelib/global/qhooks.cpp b/src/corelib/global/qhooks.cpp
index 020dee3710..79f9b7d6c2 100644
--- a/src/corelib/global/qhooks.cpp
+++ b/src/corelib/global/qhooks.cpp
@@ -67,7 +67,7 @@ quintptr Q_CORE_EXPORT qtHookData[] = {
// The required sizes and offsets are tested in tests/auto/other/toolsupport.
// When this fails and the change was intentional, adjust the test and
// adjust this value here.
- 17
+ 18
};
Q_STATIC_ASSERT(QHooks::LastHookIndex == sizeof(qtHookData) / sizeof(qtHookData[0]));
diff --git a/src/corelib/time/qdatetime_p.h b/src/corelib/time/qdatetime_p.h
index 6e4120d762..f4f00a8b9b 100644
--- a/src/corelib/time/qdatetime_p.h
+++ b/src/corelib/time/qdatetime_p.h
@@ -56,7 +56,7 @@
#include "qplatformdefs.h"
#include "QtCore/qatomic.h"
#include "QtCore/qdatetime.h"
-#include "QtCore/qpair.h"
+#include "QtCore/qshareddata.h"
#if QT_CONFIG(timezone)
#include "qtimezone.h"
@@ -64,7 +64,7 @@
QT_BEGIN_NAMESPACE
-class QDateTimePrivate
+class QDateTimePrivate : public QSharedData
{
public:
// forward the declarations from QDateTime (this makes them public)
@@ -110,13 +110,6 @@ public:
DaylightMask = SetToStandardTime | SetToDaylightTime
};
- QDateTimePrivate() : m_msecs(0),
- m_status(StatusFlag(Qt::LocalTime << TimeSpecShift)),
- m_offsetFromUtc(0),
- ref(0)
- {
- }
-
static QDateTime::Data create(const QDate &toDate, const QTime &toTime, Qt::TimeSpec toSpec,
int offsetSeconds);
@@ -124,10 +117,9 @@ public:
static QDateTime::Data create(const QDate &toDate, const QTime &toTime, const QTimeZone & timeZone);
#endif // timezone
- qint64 m_msecs;
- StatusFlags m_status;
- int m_offsetFromUtc;
- mutable QAtomicInt ref;
+ StatusFlags m_status = StatusFlag(Qt::LocalTime << TimeSpecShift);
+ qint64 m_msecs = 0;
+ int m_offsetFromUtc = 0;
#if QT_CONFIG(timezone)
QTimeZone m_timeZone;
#endif // timezone
diff --git a/tests/auto/other/toolsupport/tst_toolsupport.cpp b/tests/auto/other/toolsupport/tst_toolsupport.cpp
index 8c129adaf3..ab7bca8322 100644
--- a/tests/auto/other/toolsupport/tst_toolsupport.cpp
+++ b/tests/auto/other/toolsupport/tst_toolsupport.cpp
@@ -135,11 +135,11 @@ void tst_toolsupport::offsets_data()
{
QTest::newRow("QDateTimePrivate::m_msecs")
- << pmm_to_offsetof(&QDateTimePrivate::m_msecs) << 0 << 0;
+ << pmm_to_offsetof(&QDateTimePrivate::m_msecs) << 8 << 8;
QTest::newRow("QDateTimePrivate::m_status")
- << pmm_to_offsetof(&QDateTimePrivate::m_status) << 8 << 8;
+ << pmm_to_offsetof(&QDateTimePrivate::m_status) << 4 << 4;
QTest::newRow("QDateTimePrivate::m_offsetFromUtc")
- << pmm_to_offsetof(&QDateTimePrivate::m_offsetFromUtc) << 12 << 12;
+ << pmm_to_offsetof(&QDateTimePrivate::m_offsetFromUtc) << 16 << 16;
QTest::newRow("QDateTimePrivate::m_timeZone")
<< pmm_to_offsetof(&QDateTimePrivate::m_timeZone) << 20 << 24;
}