summaryrefslogtreecommitdiff
path: root/src/corelib/time/qdatetime.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2022-01-11 15:01:22 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2022-01-14 15:31:06 +0100
commit16e970aa81131259bed3a7b4bf119ed457ee9183 (patch)
tree2af0c4a3571d3060e182fe072e6c5047756b98c9 /src/corelib/time/qdatetime.cpp
parentae21679e3ae7a93a7916982315c1bd36582096b4 (diff)
downloadqtbase-16e970aa81131259bed3a7b4bf119ed457ee9183.tar.gz
Fix an assertion failure in massageAdjustedDateTime()
The QDateTimeData &d it's passed is a copy that's about to be modified; before we do so, we haven't detached so its internals have a ref-count of two, contradicting an assertion in the non-const Data::operator->(); so just directly access d.d->m_timezone, since we know that spec == TimeZone implies !isShort(). Added test that triggered the assertion and now doesn't. Fixes: QTBUG-99668 Change-Id: I07321ad91be5adce524be18e4ab82eee7110dc6a Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 5d228beb520d92c985497fb43fa91d2920db6cb0)
Diffstat (limited to 'src/corelib/time/qdatetime.cpp')
-rw-r--r--src/corelib/time/qdatetime.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp
index 7085604197..9d60fcf65c 100644
--- a/src/corelib/time/qdatetime.cpp
+++ b/src/corelib/time/qdatetime.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2021 The Qt Company Ltd.
+** Copyright (C) 2022 The Qt Company Ltd.
** Copyright (C) 2016 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
@@ -4551,9 +4551,9 @@ static inline void massageAdjustedDateTime(const QDateTimeData &d, QDate *date,
QDateTimePrivate::DaylightStatus status = QDateTimePrivate::UnknownDaylightTime;
localMSecsToEpochMSecs(timeToMSecs(*date, *time), &status, date, time);
#if QT_CONFIG(timezone)
- } else if (spec == Qt::TimeZone && d->m_timeZone.isValid()) {
+ } else if (spec == Qt::TimeZone && d.d->m_timeZone.isValid()) {
QDateTimePrivate::zoneMSecsToEpochMSecs(timeToMSecs(*date, *time),
- d->m_timeZone,
+ d.d->m_timeZone,
QDateTimePrivate::UnknownDaylightTime,
date, time);
#endif // timezone