summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <[email protected]>2025-06-25 08:46:10 +0200
committerMarc Mutz <[email protected]>2025-06-25 12:08:18 +0000
commitbc6f4c5db46e1d8263e32e02f2ca6e49d6b4082d (patch)
tree4f28f9816b562aa5063a9efacfdc399f8add1ad4
parentec0928c6c9a365007ac9f49dbc3c7059aa35af4e (diff)
QQuaternion: make a mutable function-static int[] constexpr
The array, despite being declared mutable, is never modified (and doing so would be a data race if threads concurrently call QQuaternion::fromRotationMatrix(), because it was declared static). Fix by making it constexpr instead. It need not be static, as the compiler will just optimize it away, anyway. Amends ba640a75a5cc9fec63a5204ccf143dbb7f398842. Pick-to: 6.10 6.9 6.8 6.5 Change-Id: I0a37f7718b1e79f34d8dd56dc56d951cb8a1d44c Reviewed-by: Friedemann Kleint <[email protected]>
-rw-r--r--src/gui/math3d/qquaternion.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp
index e7c59452085..41ef93e2cb0 100644
--- a/src/gui/math3d/qquaternion.cpp
+++ b/src/gui/math3d/qquaternion.cpp
@@ -609,7 +609,7 @@ QQuaternion QQuaternion::fromRotationMatrix(const QMatrix3x3 &rot3x3)
axis[1] = (rot3x3(0, 2) - rot3x3(2, 0)) / s;
axis[2] = (rot3x3(1, 0) - rot3x3(0, 1)) / s;
} else {
- static int s_next[3] = { 1, 2, 0 };
+ constexpr int s_next[3] = { 1, 2, 0 };
int i = 0;
if (rot3x3(1, 1) > rot3x3(0, 0))
i = 1;