From 85ded847cecb0f7e62080dd9c669b9b0cff3576b Mon Sep 17 00:00:00 2001 From: Jonathan <30329245+CookStar@users.noreply.github.com> Date: Thu, 3 Dec 2020 06:56:39 +0900 Subject: [PATCH] Changed AutoUnload to be able to manage objects generated from custom packages. --- .../packages/source-python/core/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/source-python/packages/source-python/core/__init__.py b/addons/source-python/packages/source-python/core/__init__.py index 70b291a89..628d1fa71 100755 --- a/addons/source-python/packages/source-python/core/__init__.py +++ b/addons/source-python/packages/source-python/core/__init__.py @@ -114,8 +114,13 @@ def __new__(cls, *args, **kwargs): path = frame.f_code.co_filename # Don't keep hostage instances that will never be unloaded - if not path.startswith(PLUGIN_PATH): - return self + while not path.startswith(PLUGIN_PATH): + frame = frame.f_back + if frame is None: + return self + path = frame.f_code.co_filename + if path.startswith('