From e4d9303a467b74eed1986fd3f7391500ff4ba0d7 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 3 May 2023 13:14:16 +0200 Subject: [PATCH] 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 (cherry picked from commit 77d0f3753643fa818c4bef7542f7e5d97812252c) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/time/qtimezoneprivate_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/time/qtimezoneprivate_p.h b/src/corelib/time/qtimezoneprivate_p.h index 3cc9fcbcbac..cb045ab5c36 100644 --- a/src/corelib/time/qtimezoneprivate_p.h +++ b/src/corelib/time/qtimezoneprivate_p.h @@ -330,7 +330,7 @@ private: mutable QExplicitlySharedDataPointer m_icu; #endif QTzTimeZoneCacheEntry cached_data; - QList tranCache() const { return cached_data.m_tranTimes; } + const QList &tranCache() const { return cached_data.m_tranTimes; } }; #endif // Q_OS_UNIX