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.5
Change-Id: I466f5cedea427608b434b71fda0d1e50619b9b20
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7d44817fc06e2eb4f5ff1fbce8e1905652825c05)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Rym Bouabid 2024-04-11 12:54:45 +02:00 committed by Qt Cherry-pick Bot
parent 8aae3bd438
commit c304f45b54

View File

@ -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)