diff options
author | Marc Mutz <[email protected]> | 2025-06-06 20:19:53 +0200 |
---|---|---|
committer | Marc Mutz <[email protected]> | 2025-06-12 14:04:58 +0200 |
commit | e4b0549a4c3f55828488fad6e6f5723072d6a291 (patch) | |
tree | 719526e76bac27d489834536efce8b6ec4e2d1a5 | |
parent | 5aefe2d9a1d56f6134fcbbdff260c79082eea661 (diff) |
QSocks5SocketEngine: don't depend on zero-initialization of QBasicAtomic
It's unclear¹ whether static zero-initialization of a static
QBasicAtomic actually initializes the object with a zero value, or
whether it remains default-constructed (without a value until a
following call to std::atomic_init gives it one).
Play it safe and use Q_BASIC_ATOMIC_INITIALIZER(0) to dodge any issues
the old code may have had.
¹ see ongoing discussion on the Jira ticket
Amends 04d6495bf773a6bb0d4fa6980df22d3b81a605b0.
Task-number: QTBUG-137465
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Iee0d75ce10a589390afdd9069b7040a1c9c608e1
Reviewed-by: Thiago Macieira <[email protected]>
-rw-r--r-- | src/network/socket/qsocks5socketengine.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp index f6dc0c6855e..d569dcc0947 100644 --- a/src/network/socket/qsocks5socketengine.cpp +++ b/src/network/socket/qsocks5socketengine.cpp @@ -966,7 +966,7 @@ QSocks5SocketEngine::~QSocks5SocketEngine() static int nextDescriptor() { - static QBasicAtomicInt counter; + Q_CONSTINIT static QBasicAtomicInt counter = Q_BASIC_ATOMIC_INITIALIZER(0); return 1 + counter.fetchAndAddRelaxed(1); } |