Commit 777d3337 authored by PACANOWSKI Romain's avatar PACANOWSKI Romain
Browse files

avoid self assignment in the operator=

parent 1aa83c01
......@@ -102,6 +102,13 @@ template<class T> class ptr
//! is incremented.
ptr<T>& operator=(const ptr<T>& a)
{
//RP: Check and avoid assignment to itself
if ( (void*) this == (void *) &a)
{
return *this;
}
_counter->decrement();
if(_counter->value() < 1)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment