diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2019-01-30 21:13:51 -0800 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2019-02-01 20:53:34 +0000 |
commit | 188eea0eb47c499f70a60f573948d529089d93b1 (patch) | |
tree | 7c37e96b0505f31d3eb29a8e8f3d96813a6a5a7c /src/winmain/qtmain_win.cpp | |
parent | d84912838c1df383d2a9537aefa34e06a9780f08 (diff) |
Fix race condition in getting the system locale data
QSharedDataPointer obeys the regular Qt container thread-safety rules:
it's thread-safe in const methods but not in mutating ones. QSDP::data()
is mutating, which causes a data race. For example, if the contained
QLocalePrivate has a refcount of 2 and two threads see that, both
threads will try to detach and then replace the pointer, but that
pointer replacement is not atomic.
Using QExplicitSharedDataPointer makes the race go away, since data() is
now non-mutating. QESDP is used only to destroy the QLocalePrivate on
program shutdown.
Note that there are still race conditions relating to *updating* the
locale private.
Fixes: QTBUG-73403
Change-Id: Id98140e1c2f0426cabbefffd157ed6ec30a3e08f
Reviewed-by: Thomas Sondergaard <thomas@sondergaard.cc>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/winmain/qtmain_win.cpp')
0 files changed, 0 insertions, 0 deletions