From 7d44817fc06e2eb4f5ff1fbce8e1905652825c05 Mon Sep 17 00:00:00 2001 From: Rym Bouabid Date: Thu, 11 Apr 2024 12:54:45 +0200 Subject: PRNGLocker: disable copy and move Axivion (SV61) points out based on Qt-RuleOfThree the lack of copy and move constructors and operators. We don't need them, so tell the compiler not to create them. As a drive-by change mark the constructor as explicit and not discardable. Task-number: QTBUG-122619 Pick-to: 6.7 6.5 Change-Id: I466f5cedea427608b434b71fda0d1e50619b9b20 Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira --- src/corelib/global/qrandom.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp index 21448b8c14..fd742898f8 100644 --- a/src/corelib/global/qrandom.cpp +++ b/src/corelib/global/qrandom.cpp @@ -377,8 +377,9 @@ struct QRandomGenerator::SystemAndGlobalGenerators struct PRNGLocker { + Q_DISABLE_COPY_MOVE(PRNGLocker) const bool locked; - PRNGLocker(const QRandomGenerator *that) + Q_NODISCARD_CTOR explicit PRNGLocker(const QRandomGenerator *that) : locked(that == globalNoInit()) { if (locked) -- cgit v1.2.3