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 <edward.welbourne@qt.io>
This commit is contained in:
Timur Pocheptsov 2016-06-27 14:30:59 +02:00 committed by Edward Welbourne
parent 8cee6864c6
commit f8dc769655

View File

@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE
// Create the system default time zone // Create the system default time zone
QMacTimeZonePrivate::QMacTimeZonePrivate() QMacTimeZonePrivate::QMacTimeZonePrivate()
: m_nstz(0)
{ {
init(systemTimeZoneId()); init(systemTimeZoneId());
} }