Fixed copy assign operator in sf::Sound so it checks for self-assignment
This commit is contained in:
parent
5e5ac64c76
commit
54204058a4
@ -160,6 +160,10 @@ Sound& Sound::operator =(const Sound& right)
|
|||||||
// the list of sound instances contained in the buffers and unnecessarily
|
// the list of sound instances contained in the buffers and unnecessarily
|
||||||
// destroy/create OpenAL sound sources
|
// destroy/create OpenAL sound sources
|
||||||
|
|
||||||
|
// Handle self-assignment here, as no copy-and-swap idiom is being used
|
||||||
|
if (this == &right)
|
||||||
|
return *this;
|
||||||
|
|
||||||
// Delegate to base class, which copies all the sound attributes
|
// Delegate to base class, which copies all the sound attributes
|
||||||
SoundSource::operator=(right);
|
SoundSource::operator=(right);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user