mirror of
https://github.com/taglib/taglib.git
synced 2025-07-18 21:14:23 -04:00
Add self-assignment check in operator=
Method 'operator=' should check its argument with 'this' pointer.
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user