Fix #2432801 - Make SwigValueWrapper exception safe for when copy constructors throw exceptions

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10997 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2008-12-22 21:43:48 +00:00
commit 7adb84f448
2 changed files with 5 additions and 1 deletions

View file

@ -1,6 +1,10 @@
Version 1.3.37 (in progress) Version 1.3.37 (in progress)
============================ ============================
2008-12-22: wsfulton
Fix #2432801 - Make SwigValueWrapper exception safe for when copy constructors
throw exceptions.
2008-12-21: wsfulton 2008-12-21: wsfulton
Apply patch #2440046 which fixes possible seg faults for member and global Apply patch #2440046 which fixes possible seg faults for member and global
variable char arrays when the strings are larger than the string array size. variable char arrays when the strings are larger than the string array size.

View file

@ -647,7 +647,7 @@ public:
SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { } SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
SwigValueWrapper(const T& t) : tt(new T(t)) { } SwigValueWrapper(const T& t) : tt(new T(t)) { }
~SwigValueWrapper() { delete tt; } ~SwigValueWrapper() { delete tt; }
SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; } SwigValueWrapper& operator=(const T& t) { T *oldtt = tt; tt = 0; delete oldtt; tt = new T(t); return *this; }
operator T&() const { return *tt; } operator T&() const { return *tt; }
T *operator&() { return tt; } T *operator&() { return tt; }
private: private: