Return TZ time-zone backend's tranCache() as a const reference

Assorted code was iterating from tranCache().cbegin() to
tranCache().cend(), and getting away with it because CoW means
tranCache()'s two distinct returns were referencing the same pimpl,
but let's make tranCache() return a const ref so that these calls are
all accessing the same object (and we get complaints if we do anything
non-const with it via this method).

Axivion-Id: qt_qtbase_dev_linux:SV1685
Change-Id: If43ccf37c2b27837e5462cb4a0eeb07f0045cbfe
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 77d0f3753643fa818c4bef7542f7e5d97812252c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Edward Welbourne 2023-05-03 13:14:16 +02:00 committed by Qt Cherry-pick Bot
parent 5b2e3475ba
commit e4d9303a46

View File

@ -330,7 +330,7 @@ private:
mutable QExplicitlySharedDataPointer<const QIcuTimeZonePrivate> m_icu;
#endif
QTzTimeZoneCacheEntry cached_data;
QList<QTzTransitionTime> tranCache() const { return cached_data.m_tranTimes; }
const QList<QTzTransitionTime> &tranCache() const { return cached_data.m_tranTimes; }
};
#endif // Q_OS_UNIX