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
Pick-to: 5.15 6.2 6.5 6.6
Change-Id: If43ccf37c2b27837e5462cb4a0eeb07f0045cbfe
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Edward Welbourne 2023-05-03 13:14:16 +02:00
parent 3ccf2f8308
commit 77d0f37536

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