Browse Source

Fix memory leak

Wolf Clement 2 years ago
parent
commit
be66eb2a3b
3 changed files with 6 additions and 3 deletions
  1. 1 1
      build.py
  2. 1 1
      setup.py
  3. 4 1
      sounds.py

+ 1 - 1
build.py

@@ -21,7 +21,7 @@ executables = [Executable("main.py", base=base, targetName="csgo-custom-sounds.e
 
 setup(
     name="csgo-custom-sounds",
-    version="1.5.1",
+    version="1.5.2",
     description="Play custom sounds via Gamestate Integration",
     options=dict(build_exe=buildOptions),
     executables=executables,

+ 1 - 1
setup.py

@@ -6,7 +6,7 @@ except ImportError:
 
 setup(
     name="csgo-custom-sounds",
-    version="1.5.1",
+    version="1.5.2",
     description="Play custom sounds via Gamestate Integration",
     python_requires="==3.*,>=3.7.0",
     author="kiwec",

+ 4 - 1
sounds.py

@@ -77,7 +77,8 @@ class SoundManager:
         executor.shutdown(wait=False)
         await asyncio.gather(*tasks)
         wx.CallAfter(
-            self.client.gui.SetStatusText, f"{self.nb_max_sounds} sounds loaded.",
+            self.client.gui.SetStatusText,
+            f"{self.nb_max_sounds} sounds loaded.",
         )
 
     async def _play(self, sound) -> None:
@@ -92,6 +93,8 @@ class SoundManager:
             # Don't end the thread until the sound finished playing
             await asyncio.sleep(1)
 
+        sound.destroy()
+
     def play(self, sound_name: str) -> bool:
         """Tries playing a sound by its name.