Fixed copy assign operator in sf::Sound so it checks for self-assignment

This commit is contained in:
fgallegosalido 2021-01-16 18:39:09 +01:00 committed by Lukas Dürrenberger
parent 5e5ac64c76
commit 54204058a4

View File

@ -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);