From 46b72b622fd988d0c045856b1579c76e7591fbe9 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 17 May 2016 10:59:28 +0200 Subject: [PATCH] Changed: Delete SoundMngr to avoid memory leaks --- code/ryzom/client/src/init.cpp | 3 ++- code/ryzom/client/src/main_loop_utilities.cpp | 3 ++- code/ryzom/client/src/release.cpp | 4 ++-- code/ryzom/client/src/user_entity.cpp | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/code/ryzom/client/src/init.cpp b/code/ryzom/client/src/init.cpp index a55a09db9..f7a5af7af 100644 --- a/code/ryzom/client/src/init.cpp +++ b/code/ryzom/client/src/init.cpp @@ -1555,7 +1555,8 @@ void postlogInit() { nlwarning("init : Error when creating 'SoundMngr' : %s", e.what()); // leak the alocated sound manager... - SoundMngr = 0; + delete SoundMngr; + SoundMngr = NULL; } // Play Music just after the SoundMngr is inited diff --git a/code/ryzom/client/src/main_loop_utilities.cpp b/code/ryzom/client/src/main_loop_utilities.cpp index 81a52b2d3..415764bfa 100644 --- a/code/ryzom/client/src/main_loop_utilities.cpp +++ b/code/ryzom/client/src/main_loop_utilities.cpp @@ -329,7 +329,8 @@ void updateFromClientCfg() catch(const Exception &e) { nlwarning("init : Error when creating 'SoundMngr' : %s", e.what()); - SoundMngr = 0; + delete SoundMngr; + SoundMngr = NULL; } // re-init with good SFX/Music Volume diff --git a/code/ryzom/client/src/release.cpp b/code/ryzom/client/src/release.cpp index e2a96c397..da456fadb 100644 --- a/code/ryzom/client/src/release.cpp +++ b/code/ryzom/client/src/release.cpp @@ -478,7 +478,7 @@ void releaseOutGame() if(SoundMngr) { delete SoundMngr; - SoundMngr = 0; + SoundMngr = NULL; } // Delete the driver. @@ -573,7 +573,7 @@ void release() if(SoundMngr) { delete SoundMngr; - SoundMngr = 0; + SoundMngr = NULL; } // Release the Entities Animation Manager diff --git a/code/ryzom/client/src/user_entity.cpp b/code/ryzom/client/src/user_entity.cpp index 1d0c27570..f5b4b0f42 100644 --- a/code/ryzom/client/src/user_entity.cpp +++ b/code/ryzom/client/src/user_entity.cpp @@ -2381,7 +2381,7 @@ void CUserEntity::updateSound(const TTime &time) H_AUTO_USE ( RZ_Client_Update_Sound ); // no sound manager, no need to update sound - if (SoundMngr == 0) + if (SoundMngr == NULL) return; if (!(StereoHMD && true)) // TODO: ClientCfg.Headphone