From 1b16f79bf2a4efa5c8f60ae48adbf563fa819611 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Thu, 2 May 2019 18:14:20 +0200 Subject: [PATCH] QSharedData: delete the copy assignment operator Do not merely declare it as private, use C++11's = delete. This has the nice side effect that subclasses are no longer implicitly copy assignable either (they shouldn't be). Change-Id: Icd03f71006c31baf7d079365fa3bea1a2a9d559b Reviewed-by: Thiago Macieira --- src/corelib/tools/qshareddata.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/corelib/tools/qshareddata.h b/src/corelib/tools/qshareddata.h index 04051472d63..c29a509209e 100644 --- a/src/corelib/tools/qshareddata.h +++ b/src/corelib/tools/qshareddata.h @@ -60,9 +60,8 @@ public: inline QSharedData() : ref(0) { } inline QSharedData(const QSharedData &) : ref(0) { } -private: // using the assignment operator would lead to corruption in the ref-counting - QSharedData &operator=(const QSharedData &); + QSharedData &operator=(const QSharedData &) = delete; }; template class QSharedDataPointer