From a5cc8adfef8cad5e420d4b48397dac199c7f7487 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 8 May 2004 20:42:33 +0000 Subject: [PATCH] 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 --- stepmania/src/RageSound.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/stepmania/src/RageSound.cpp b/stepmania/src/RageSound.cpp index b49a2b9fab..219830829e 100644 --- a/stepmania/src/RageSound.cpp +++ b/stepmania/src/RageSound.cpp @@ -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 )