From a07c718c17df4d376c4fcf5caf67e086a4f0bd53 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 5 Apr 2024 15:15:13 +0200 Subject: [PATCH] QSystemLocale(): disable copy and move Axivion (SV546) points out (based on a clazy "rule of three" that might be rule of five by now) the lack of move and copy assignment and construction. We don't want those anyway, so tell the compiler not to create them. Pick-to: 6.5 Task-number: QTBUG-122619 Change-Id: Ie951a2c3d60d76ad3448310d3f9bbda22190015b Reviewed-by: Giuseppe D'Angelo Reviewed-by: Thiago Macieira (cherry picked from commit 21ef6d930ad3eb2fb435cd601692cb5cc1726bd8) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/text/qlocale_p.h | 1 + src/plugins/platforms/android/qandroidsystemlocale.h | 1 + tests/auto/corelib/text/qlocale/tst_qlocale.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/src/corelib/text/qlocale_p.h b/src/corelib/text/qlocale_p.h index ee0a28e94ec..ee333e9c8fc 100644 --- a/src/corelib/text/qlocale_p.h +++ b/src/corelib/text/qlocale_p.h @@ -105,6 +105,7 @@ struct QLocaleData; // Subclassed by Android platform plugin: class Q_CORE_EXPORT QSystemLocale { + Q_DISABLE_COPY_MOVE(QSystemLocale) QSystemLocale *next = nullptr; // Maintains a stack. public: diff --git a/src/plugins/platforms/android/qandroidsystemlocale.h b/src/plugins/platforms/android/qandroidsystemlocale.h index 48e1d94a569..b4a4070bd59 100644 --- a/src/plugins/platforms/android/qandroidsystemlocale.h +++ b/src/plugins/platforms/android/qandroidsystemlocale.h @@ -11,6 +11,7 @@ QT_BEGIN_NAMESPACE class QAndroidSystemLocale : public QSystemLocale { + Q_DISABLE_COPY_MOVE(QAndroidSystemLocale) public: QAndroidSystemLocale(); diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp index bde19a6fca1..bfbdfc9bc59 100644 --- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp @@ -3966,6 +3966,7 @@ void tst_QLocale::bcp47Name() # ifdef QT_BUILD_INTERNAL class MySystemLocale : public QSystemLocale { + Q_DISABLE_COPY_MOVE(MySystemLocale) public: MySystemLocale(const QString &locale) : m_name(locale), m_id(QLocaleId::fromName(locale)), m_locale(locale)