diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-06-26 09:35:13 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-06-26 16:29:13 +0100 |
commit | cd29cab883a6a7a0e028ca6756daa2f3cc8d51f6 (patch) | |
tree | d2626221e24b967147e2be18e2b389095d0373b2 /tools | |
parent | 112645f75816c4902ccf8a2a97ef57e8f13429b8 (diff) |
check for self-assign
Change-Id: I6ffaaa36f2e594a2e8155589a4d7000db21ab30b
Diffstat (limited to 'tools')
-rw-r--r-- | tools/source/generic/bigint.cxx | 3 | ||||
-rw-r--r-- | tools/source/generic/poly2.cxx | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/tools/source/generic/bigint.cxx b/tools/source/generic/bigint.cxx index e7a98b5eebec..3311efd459b5 100644 --- a/tools/source/generic/bigint.cxx +++ b/tools/source/generic/bigint.cxx @@ -616,6 +616,9 @@ BigInt::operator double() const BigInt& BigInt::operator=( const BigInt& rBigInt ) { + if (this == &rBigInt) + return *this; + if ( rBigInt.bIsBig ) memcpy( (void*)this, (const void*)&rBigInt, sizeof( BigInt ) ); else diff --git a/tools/source/generic/poly2.cxx b/tools/source/generic/poly2.cxx index 7ef7df199f4f..0262a36a0af6 100644 --- a/tools/source/generic/poly2.cxx +++ b/tools/source/generic/poly2.cxx @@ -521,6 +521,9 @@ Polygon& PolyPolygon::operator[]( sal_uInt16 nPos ) PolyPolygon& PolyPolygon::operator=( const PolyPolygon& rPolyPoly ) { + if (this == &rPolyPoly) + return *this; + DBG_ASSERT( rPolyPoly.mpImplPolyPolygon->mnRefCount < 0xFFFFFFFE, "PolyPolygon: RefCount overflow" ); rPolyPoly.mpImplPolyPolygon->mnRefCount++; |