diff --git a/simgear/sound/soundmgr_openal.cxx b/simgear/sound/soundmgr_openal.cxx index 0785edb5..b525b31f 100644 --- a/simgear/sound/soundmgr_openal.cxx +++ b/simgear/sound/soundmgr_openal.cxx @@ -69,7 +69,8 @@ SGSoundMgr::SGSoundMgr() { // initialize OpenAL alutInit( 0, NULL ); - alGetError(); + atexit(alutExit); + if ( alGetError() == AL_NO_ERROR) { working = true; } else { @@ -119,8 +120,6 @@ SGSoundMgr::~SGSoundMgr() { SGSoundSample *sample = sample_current->second; delete sample; } - - alutExit(); } diff --git a/simgear/sound/xmlsound.cxx b/simgear/sound/xmlsound.cxx index 48a2d0ee..fbb4504a 100644 --- a/simgear/sound/xmlsound.cxx +++ b/simgear/sound/xmlsound.cxx @@ -80,11 +80,8 @@ SGXmlSound::~SGXmlSound() { _sample->stop(); - if (_property) - delete _property; - - if (_condition) - delete _condition; + delete _property; + delete _condition; _volume.clear(); _pitch.clear();