From f8dc769655959b290d70a2e66e2c3a625aa813cd Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 27 Jun 2016 14:30:59 +0200 Subject: QMacTimeZonePrivate - correctly initialize m_nstz data-member The default ctor never initializes m_nstz but calls init with [NSTimeZone systemTimeZone].name. Init (re)sets m_nstz _only_ if this ianaId is in [NSTimeZone knownTimeZoneName], which is not guaranteed (a good example is "US/Pacific" that can be returned by systemTimeZoneId() - the similar problem is described in [*]. Set m_nstz to nil in ctor, so if 'init' fails we still have a valid (nil) pointer. [*] http://stackoverflow.com/questions/19819268/convert-ios-localtimezone-to-a-knowntimezone. Task-number: QTBUG-54330 Change-Id: I68917926350aad3158d44a06f06721f25b3fdb74 Reviewed-by: Edward Welbourne --- src/corelib/tools/qtimezoneprivate_mac.mm | 1 + 1 file changed, 1 insertion(+) (limited to 'src/corelib/tools/qtimezoneprivate_mac.mm') diff --git a/src/corelib/tools/qtimezoneprivate_mac.mm b/src/corelib/tools/qtimezoneprivate_mac.mm index f316fe0a6d..4e5034516b 100644 --- a/src/corelib/tools/qtimezoneprivate_mac.mm +++ b/src/corelib/tools/qtimezoneprivate_mac.mm @@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE // Create the system default time zone QMacTimeZonePrivate::QMacTimeZonePrivate() + : m_nstz(0) { init(systemTimeZoneId()); } -- cgit v1.2.3