Skip to content

Commit 3a2ef92

Browse files
authored
Removed unnecessary _BaseSound._unload_instance function. (#496)
* Removed unnecessary _BaseSound._unload_instance function * Deleted WeakAutoUnload. * Changed _PrecacheBase also not to call self._downloads._unload_instance().
1 parent cb5d8d7 commit 3a2ef92

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

Diff for: addons/source-python/packages/source-python/engines/precache.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,7 @@ def _server_spawn(self, game_event):
113113
self._precache()
114114

115115
def _unload_instance(self):
116-
"""Remove from the downloads list and unregister server_spawn."""
117-
# Remove the path from the downloads list
118-
try:
119-
self._downloads._unload_instance()
120-
except AttributeError:
121-
pass
122-
116+
"""Unregister server_spawn."""
123117
# Unregister the server_spawn event
124118
event_manager.unregister_for_event('server_spawn', self._server_spawn)
125119

Diff for: addons/source-python/packages/source-python/engines/sound.py

+1-8
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
from mutagen import oggvorbis
2222

2323
# Source.Python Imports
24-
# Core
25-
from core import WeakAutoUnload
2624
# Engines
2725
from engines import engines_logger
2826
# Entities
@@ -100,7 +98,7 @@ class Attenuation(float, Enum):
10098
# =============================================================================
10199
# >> CLASSES
102100
# =============================================================================
103-
class _BaseSound(WeakAutoUnload):
101+
class _BaseSound:
104102
"""Base class for sound classes."""
105103

106104
# Set the base _downloads attribute to know whether
@@ -285,11 +283,6 @@ def duration(self):
285283
self._duration = value
286284
return value
287285

288-
def _unload_instance(self):
289-
"""Remove the sample from the downloads list."""
290-
if self._downloads is not None:
291-
self._downloads._unload_instance()
292-
293286

294287
class Sound(_BaseSound):
295288
"""Class used to interact with precached sounds.

0 commit comments

Comments
 (0)