aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2016-05-24 10:59:09 -0700
committerJake Petroules <jake.petroules@qt.io>2016-05-25 08:37:19 +0000
commitc5ea3e3a3d5df68790e82cee17923bb23a4997b4 (patch)
treeb7373beef2d6726a68348efac0f7473857fd1999
parente7d971d1768a69e4afc64a3d050268e3f86b0ccd (diff)
Check for self-assignment in ProjectData assignment operator.
Should not omit this in dealing with dynamic memory. Change-Id: Ifc1e70a353446ab61023b9224a23285febfa6b97 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r--src/lib/corelib/api/projectdata.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/corelib/api/projectdata.cpp b/src/lib/corelib/api/projectdata.cpp
index afc4d50a9..12cdeda9c 100644
--- a/src/lib/corelib/api/projectdata.cpp
+++ b/src/lib/corelib/api/projectdata.cpp
@@ -737,8 +737,10 @@ PropertyMap::~PropertyMap()
PropertyMap &PropertyMap::operator =(const PropertyMap &other)
{
- delete d;
- d = new Internal::PropertyMapPrivate(*other.d);
+ if (this != &other) {
+ delete d;
+ d = new Internal::PropertyMapPrivate(*other.d);
+ }
return *this;
}