Commit 4692d4b3 authored by Roman Donchenko's avatar Roman Donchenko

Fix bug: cv::String would break if assigned to itself.

parent 70deda35
...@@ -580,6 +580,8 @@ String::~String() ...@@ -580,6 +580,8 @@ String::~String()
inline inline
String& String::operator=(const String& str) String& String::operator=(const String& str)
{ {
if (&str == this) return *this;
deallocate(); deallocate();
if (str.cstr_) CV_XADD(((int*)str.cstr_)-1, 1); if (str.cstr_) CV_XADD(((int*)str.cstr_)-1, 1);
cstr_ = str.cstr_; cstr_ = str.cstr_;
......
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