From 41587d61eea89310907929de61dfa258a39950d4 Mon Sep 17 00:00:00 2001 From: Erik Hofman Date: Sat, 23 Jan 2021 12:01:47 +0100 Subject: [PATCH] A reinit of the FGFX class left all the previous samples in the sample group in a stale state. The sample group code is robust enough to handle such a situation but they still occupy memory. So stop the inherited sample group explicityly at reinit to free the samples. --- src/Sound/fg_fx.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Sound/fg_fx.cxx b/src/Sound/fg_fx.cxx index fb90d2e66..f07003f1a 100644 --- a/src/Sound/fg_fx.cxx +++ b/src/Sound/fg_fx.cxx @@ -159,9 +159,11 @@ FGFX::init() void FGFX::reinit() { + SGSampleGroup::stop(); std::for_each(_sound.begin(), _sound.end(), [](const SGXmlSound* snd) { delete snd; }); _sound.clear(); init(); + SGSampleGroup::resume(); }