From fd41d63b2a731fde1febcf4964850938415cba38 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 27 Jul 2010 19:32:15 +0200 Subject: [PATCH] Fixed: #1032 Crash in OpenAL driver when a music is playing and user quit client --- code/ryzom/client/src/interface_v3/music_player.cpp | 11 +++++++++++ code/ryzom/client/src/interface_v3/music_player.h | 1 + code/ryzom/client/src/release.cpp | 8 ++++---- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/music_player.cpp b/code/ryzom/client/src/interface_v3/music_player.cpp index 95b420a48..3f5782c92 100644 --- a/code/ryzom/client/src/interface_v3/music_player.cpp +++ b/code/ryzom/client/src/interface_v3/music_player.cpp @@ -103,6 +103,17 @@ void CMusicPlayer::pause () // *************************************************************************** +void CMusicPlayer::stop () +{ + if(!SoundMngr) + return; + // stop the music only if we are really playing (else risk to stop a background music!) + SoundMngr->stopMusic(0); + _State = Stopped; +} + +// *************************************************************************** + void CMusicPlayer::previous () { if (!_Songs.empty()) diff --git a/code/ryzom/client/src/interface_v3/music_player.h b/code/ryzom/client/src/interface_v3/music_player.h index 59987e48f..f367d3df8 100644 --- a/code/ryzom/client/src/interface_v3/music_player.h +++ b/code/ryzom/client/src/interface_v3/music_player.h @@ -46,6 +46,7 @@ public: void playSongs (const std::vector &songs); void play (); // Play the song at current position, if playing, restart. If paused, resume. void pause (); + void stop (); void previous (); void next (); diff --git a/code/ryzom/client/src/release.cpp b/code/ryzom/client/src/release.cpp index 7dd8519bd..0e7404fd9 100644 --- a/code/ryzom/client/src/release.cpp +++ b/code/ryzom/client/src/release.cpp @@ -212,8 +212,8 @@ void releaseMainLoopReselect() // alredy called from farTPMainLoop() // --R2::getEditor().autoConfigRelease(IsInRingSession); - // Pause any user played music - MusicPlayer.pause(); + // Stop the music + MusicPlayer.stop(); // only really needed at exit // --STRING_MANAGER::CStringManagerClient::instance()->flushStringCache(); @@ -362,8 +362,8 @@ void releaseMainLoop(bool closeConnection) // Release R2 editor if applicable R2::getEditor().autoConfigRelease(IsInRingSession); - // Pause the music - MusicPlayer.pause(); + // Stop the music + MusicPlayer.stop(); // flush the server string cache STRING_MANAGER::CStringManagerClient::instance()->flushStringCache();