diff --git a/src/corelib/time/qtimezoneprivate_tz.cpp b/src/corelib/time/qtimezoneprivate_tz.cpp index 4ac4559d36..9cc477d2a5 100644 --- a/src/corelib/time/qtimezoneprivate_tz.cpp +++ b/src/corelib/time/qtimezoneprivate_tz.cpp @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include #include @@ -660,7 +660,7 @@ public: private: QTzTimeZoneCacheEntry findEntry(const QByteArray &ianaId); - QHash m_cache; + QCache m_cache; QMutex m_mutex; }; @@ -842,13 +842,13 @@ QTzTimeZoneCacheEntry QTzTimeZoneCache::fetchEntry(const QByteArray &ianaId) QMutexLocker locker(&m_mutex); // search the cache... - const auto& it = m_cache.find(ianaId); - if (it != m_cache.constEnd()) - return *it; + QTzTimeZoneCacheEntry *obj = m_cache.object(ianaId); + if (obj) + return *obj; // ... or build a new entry from scratch QTzTimeZoneCacheEntry ret = findEntry(ianaId); - m_cache[ianaId] = ret; + m_cache.insert(ianaId, new QTzTimeZoneCacheEntry(ret)); return ret; }