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.7 6.6 6.5 Task-number: QTBUG-121807 Change-Id: Ie0571df2de2bf0a3f4ee767184e58b378e8cb05a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
c738a349d2
commit
ec9ca7ac43
@ -459,7 +459,6 @@ QTimeZone::QTimeZone(const QByteArray &ianaId)
|
||||
d = newBackendTimeZone();
|
||||
else // Constructor MUST produce invalid for unsupported ID.
|
||||
d = newBackendTimeZone(ianaId);
|
||||
// else: No such ID, avoid creating a TZ cache entry for it.
|
||||
}
|
||||
// Can also handle UTC with arbitrary (valid) offset, but only do so as
|
||||
// fall-back, since either of the above may handle it more informatively.
|
||||
|
@ -998,6 +998,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())
|
||||
|
Loading…
x
Reference in New Issue
Block a user