Also check available in TZ timezone's constructor

Follow up to commit 00d9a9a9b59650b8e297f91dcc600c377da5bceb - as
commented in the QTZ constructor, one of the reasons for the prior "is
available" check was to avoid creating TZ cache entries for it; so
have the TZ backend also (like ICU) overtly check for availability
before trying to find data for the given ID. This duplicates work done
later in the constructor, which can perhaps be optimised out later,
but is no worse than where we were before the commit mentioned above.

Pick-to: 6.5
Task-number: QTBUG-121807
Change-Id: Ie0571df2de2bf0a3f4ee767184e58b378e8cb05a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ec9ca7ac43cfebc74afc03de338f81a879354b2a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit a3a2d3df20a61836c41b9f115b2a8244d4381519)
This commit is contained in:
Edward Welbourne 2024-02-09 13:56:52 +01:00 committed by Qt Cherry-pick Bot
parent 47ccda4a12
commit 9f304ee3e8

View File

@ -988,6 +988,8 @@ QTzTimeZoneCacheEntry QTzTimeZoneCache::fetchEntry(const QByteArray &ianaId)
// Create a named time zone
QTzTimeZonePrivate::QTzTimeZonePrivate(const QByteArray &ianaId)
{
if (!isTimeZoneIdAvailable(ianaId)) // Avoid pointlessly creating cache entries
return;
static QTzTimeZoneCache tzCache;
auto entry = tzCache.fetchEntry(ianaId);
if (entry.m_tranTimes.isEmpty() && entry.m_posixRule.isEmpty())