[Scummvm-cvs-logs] SF.net SVN: scummvm: [26115] scummvm/trunk/common
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Mon Mar 12 23:34:32 CET 2007
Revision: 26115
http://scummvm.svn.sourceforge.net/scummvm/?rev=26115&view=rev
Author: fingolfin
Date: 2007-03-12 15:34:29 -0700 (Mon, 12 Mar 2007)
Log Message:
-----------
Protect Array<> and HashMap<> instances against self assignments
Modified Paths:
--------------
scummvm/trunk/common/array.h
scummvm/trunk/common/hashmap.h
Modified: scummvm/trunk/common/array.h
===================================================================
--- scummvm/trunk/common/array.h 2007-03-12 21:50:44 UTC (rev 26114)
+++ scummvm/trunk/common/array.h 2007-03-12 22:34:29 UTC (rev 26115)
@@ -100,6 +100,9 @@
}
Array<T>& operator =(const Array<T>& array) {
+ if (this == &array)
+ return *this;
+
if (_data)
delete [] _data;
_size = array._size;
Modified: scummvm/trunk/common/hashmap.h
===================================================================
--- scummvm/trunk/common/hashmap.h 2007-03-12 21:50:44 UTC (rev 26114)
+++ scummvm/trunk/common/hashmap.h 2007-03-12 22:34:29 UTC (rev 26115)
@@ -155,6 +155,9 @@
~HashMap();
HM_t &operator =(const HM_t &map) {
+ if (this == &map)
+ return *this;
+
// Remove the previous content and ...
clear();
delete[] _arr;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list