diff options
author | garima-g <garima.g@samsung.com> | 2015-11-05 11:16:34 +0530 |
---|---|---|
committer | garima-g <garima.g@samsung.com> | 2015-11-05 11:16:34 +0530 |
commit | 998ebf4ce6bc7d512b1c172a5ba286c616abcb11 (patch) | |
tree | b0bc4f6cf65d3ce576ed2c35b7821cf841f37a41 /taglib/mp4 | |
parent | ccaf6502144ec787c0d8cd9fc16bbe903f25b37a (diff) |
Add self-assignment check in operator=
Method 'operator=' should check its argument with 'this' pointer.
Diffstat (limited to 'taglib/mp4')
-rw-r--r-- | taglib/mp4/mp4coverart.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/taglib/mp4/mp4coverart.cpp b/taglib/mp4/mp4coverart.cpp index 2746469d..f2152335 100644 --- a/taglib/mp4/mp4coverart.cpp +++ b/taglib/mp4/mp4coverart.cpp @@ -54,11 +54,12 @@ MP4::CoverArt::CoverArt(const CoverArt &item) : d(item.d) MP4::CoverArt & MP4::CoverArt::operator=(const CoverArt &item) { - if(d->deref()) { - delete d; + if(&item != this) { + if(d->deref()) + delete d; + d = item.d; + d->ref(); } - d = item.d; - d->ref(); return *this; } |