fix mostly innocuous race condition: init ID before registering the sound,

or it might get sound position commits from other sounds due to the
uninitialized variable
This commit is contained in:
Glenn Maynard
2004-05-08 20:42:33 +00:00
parent ecea3414b3
commit a5cc8adfef
+6 -6
View File
@@ -71,10 +71,10 @@ RageSound::RageSound():
playing_thread = 0;
databuf.reserve(internal_buffer_size);
/* Register ourself. */
SOUNDMAN->RegisterSound( this );
ID = SOUNDMAN->GetUniqueID();
/* Register ourself last, once everything is initialized. */
SOUNDMAN->RegisterSound( this );
}
RageSound::~RageSound()
@@ -100,11 +100,11 @@ RageSound::RageSound(const RageSound &cpy):
*this = cpy;
/* Register ourself. */
SOUNDMAN->RegisterSound( this );
/* We have a different ID than our parent. */
ID = SOUNDMAN->GetUniqueID();
/* Register ourself. */
SOUNDMAN->RegisterSound( this );
}
RageSound &RageSound::operator=( const RageSound &cpy )