qt6-bb10/tests/auto/corelib/tools/qdatetime
Thiago Macieira a8c74ddcf7 Fix race condition in QDateTime::timeZone() and other methods
When timezone support for QDateTime was added, we decided it was a good
idea to delay creating the QTimeZone object and checking that the time
is valid in that timezone (including for local time) until the user
requested that information. Unfortunately, QExplicitlySharedDataPointer
returns a non-const T* in operator->(), which meant we were accidentally
modifying the d pointer's contents in const methods, which in turn means
those const methods were not thread-safe when operating on the same
object.

This commit changes the d pointer to QSharedDataPointer, which is safer
in this regard and pointed out where the issues with constness were
located. Since we can't lazily calculate QTimeZone anymore, we need to
do it whenever the date, time or offset changes.

Task-number: QTBUG-43703
Change-Id: Ic5d393bfd36e48a193fcffff13b9686ef4ef1454
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2015-03-07 19:22:21 +00:00
..
.gitignore Moving relevant tests to corelib/tools 2011-09-01 13:07:23 +02:00
qdatetime.pro Add Objective-C specific type converters to QDateTime 2014-10-07 18:54:21 +02:00
tst_qdatetime.cpp Fix race condition in QDateTime::timeZone() and other methods 2015-03-07 19:22:21 +00:00
tst_qdatetime_mac.mm Fixed license headers 2015-02-17 18:46:09 +00:00