Merge pull request #3058 from PhilLab:patch-2

This commit is contained in:
Vadim Pisarevsky 2014-08-11 11:10:17 +00:00
commit a15db2d9cf

View File

@ -2625,12 +2625,15 @@ template<typename _Tp> inline Ptr<_Tp>::Ptr(const Ptr<_Tp>& _ptr)
template<typename _Tp> inline Ptr<_Tp>& Ptr<_Tp>::operator = (const Ptr<_Tp>& _ptr) template<typename _Tp> inline Ptr<_Tp>& Ptr<_Tp>::operator = (const Ptr<_Tp>& _ptr)
{ {
int* _refcount = _ptr.refcount; if (this != &_ptr)
if( _refcount ) {
CV_XADD(_refcount, 1); int* _refcount = _ptr.refcount;
release(); if( _refcount )
obj = _ptr.obj; CV_XADD(_refcount, 1);
refcount = _refcount; release();
obj = _ptr.obj;
refcount = _refcount;
}
return *this; return *this;
} }