From: SourceForge.net <no...@so...> - 2008-12-16 07:43:32
|
Bugs item #2432801, was opened at 2008-12-16 16:43 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=2432801&group_id=1645 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: code generation (general) Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Maxim Yanchenko (enerjazzer) Assigned to: Nobody/Anonymous (nobody) Summary: bad SwigValueWrapper::operator= Initial Comment: Hi all, Please take a look at the operator= in the class SwigValueWrapper: SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; } As you see, tt is being deleted first, then we are copy-constructing a new object of the class T. If this constructor throws an exception, tt points to the deleted object, so wrapper object becomes unusable. What's worse, when the wrapper object is being destructed, tt will be deleted second time: ~SwigValueWrapper() { delete tt; } The version 1.1.36 still contains this bug. The bugfix is obvious: SwigValueWrapper& operator=(const T& t) { T *new_tt = new T(t); delete tt; tt = new_tt; return *this; } Thanks, Maxim ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=2432801&group_id=1645 |