Go to file
Chris Wilson 147aa29162 Fix sending UTC-offset QTimeZones through QDataStream
QTimeZone("UTC") should be valid, as "UTC" appears in the list of
availableTimeZoneIds(), and tst_QTimeZone::dataStreamTest() constructs
timezones like this, which are considered valid.

The internal representation of a QTimeZone("UTC") as created by
QTimeZone::QTimeZone(const QByteArray &ianaId) is a QUtcTimeZonePrivate
which isValid(), so the containing QTimeZone isValid() too.

When QTimeZone is serialized into a QDataStream, it calls
tz.d->serialize(ds) which is QUtcTimeZonePrivate::serialize. This
writes QStringLiteral("OffsetFromUtc") followed by the IANA ID and
the offset (etc.) to the datastream.

When QTimeZone is deserialized it looks for this marker string, and if
present, it passed all of the parameters to the QTimeZone constructor
(not just the name). However, that constructor does not support standard
IANA timezones (only custom ones), and when it detects that the supplied
IANA ID is actually listed in availableTimeZoneIds(), it leaves the
pointer to the QTimeZonePrivate uninitialized (NULL), which leaves
the QTimeZone invalid (isValid() returns false).

Thus, a valid timezone which was serialized and then deserialized has
become invalid. This also affects serialization of QDateTimes with
timezones.

Fixed by calling the name-only constructor first, which works (only) for
IANA standard timezones and leaves the QTimeZone invalid (isValid()
returns false) otherwise. In which case, we can call the many-argument
contructor to create a custom timezone with the same offset as the one
which was originally serialized.

[ChangeLog][QtCore][QTimeZone] Fixed sending IANA standard UTC-offset
QTimeZones through QDataStream, which previously came out invalid after
deserialization.

Task-number: QTBUG-60595
Change-Id: Id9c47e8bda701faae4d800e012afb6db545b2fe9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-06-08 08:34:31 +00:00
bin don't include injected headers into linker version script 2016-10-14 09:00:29 +00:00
config.tests Fix build with clang 4.0 and libstdc++ 7.1.1 2017-06-03 18:10:31 +00:00
dist Revert "Add qt_safe_ftok wrapper for ftok" 2017-05-18 21:17:52 +00:00
doc Doc: Add highlighting for a number of examples 2017-05-17 13:42:58 +00:00
examples Convert features.printdialog to QT_[REQUIRE_]CONFIG 2017-05-30 17:21:26 +00:00
lib
mkspecs Remove -permissive- flag from MSVC 2017 build 2017-06-06 14:05:44 +00:00
qmake make mkspecs not mess up -rpath-link 2017-05-31 12:57:14 +00:00
src Fix sending UTC-offset QTimeZones through QDataStream 2017-06-08 08:34:31 +00:00
tests Fix sending UTC-offset QTimeZones through QDataStream 2017-06-08 08:34:31 +00:00
util QtCore: include mocs 2017-05-05 03:03:30 +00:00
.gitattributes
.gitignore Overhaul .gitignore 2017-02-16 15:11:05 +00:00
.qmake.conf Bump version 2017-05-12 13:39:51 +02:00
.tag
config_help.txt Restore behavior of using libEGL and libGLESv2 as default for angle 2017-05-11 08:35:54 +00:00
configure Clean up mkspecs from old, unsupported and untested mkspecs 2017-04-27 22:34:34 +00:00
configure.bat configure: balk at any of {{,X}QMAKESPEC,QMAKE{PATH,FEATURES}} being set 2017-04-21 09:22:27 +00:00
configure.json configure.json: Do not test for gold linker on Windows 2017-05-23 06:14:28 +00:00
configure.pri fix licheck calls on 32 bit systems 2017-05-31 12:57:47 +00:00
header.BSD Add new license header templates and license files 2016-01-14 20:43:46 +00:00
header.BSD-OLD Add new license header templates and license files 2016-01-14 20:43:46 +00:00
header.COMM
header.FDL Add new license header templates and license files 2016-01-14 20:43:46 +00:00
header.FDL-OLD Add new license header templates and license files 2016-01-14 20:43:46 +00:00
header.GPL Add new license header templates and license files 2016-01-14 20:43:46 +00:00
header.GPL-EXCEPT Add new license header templates and license files 2016-01-14 20:43:46 +00:00
header.LGPL Add new license header templates and license files 2016-01-14 20:43:46 +00:00
header.LGPL3
header.LGPL3-COMM
header.LGPL21
header.LGPL-NOGPL2 Add new license header templates and license files 2016-01-14 20:43:46 +00:00
header.LGPL-ONLY
INSTALL
LGPL_EXCEPTION.txt
LICENSE.FDL
LICENSE.GPL2 Add new license header templates and license files 2016-01-14 20:43:46 +00:00
LICENSE.GPL3 Add new license header templates and license files 2016-01-14 20:43:46 +00:00
LICENSE.GPL3-EXCEPT Add new license header templates and license files 2016-01-14 20:43:46 +00:00
LICENSE.GPLv3 Expand license scope from "Qt GUI Toolkit" to "Qt Toolkit" 2016-06-15 07:02:32 +00:00
LICENSE.LGPL3 Add new license header templates and license files 2016-01-14 20:43:46 +00:00
LICENSE.LGPLv3 Expand license scope from "Qt GUI Toolkit" to "Qt Toolkit" 2016-06-15 07:02:32 +00:00
LICENSE.LGPLv21 Expand license scope from "Qt GUI Toolkit" to "Qt Toolkit" 2016-06-15 07:02:32 +00:00
LICENSE.PREVIEW.COMMERCIAL Add new license header templates and license files 2016-01-14 20:43:46 +00:00
qtbase.pro nuke configure -host-option 2016-12-13 18:55:59 +00:00
sync.profile Merge remote-tracking branch 'origin/5.8' into 5.9 2017-03-13 15:55:44 +01:00