-
-
Save rubidium42/4956ee7a09dcc06a2dce77a42bec6405 to your computer and use it in GitHub Desktop.
Potential solution for PR#9353
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/script/script_instance.cpp b/src/script/script_instance.cpp | |
index 3be31f187..2d32b02e8 100644 | |
--- a/src/script/script_instance.cpp | |
+++ b/src/script/script_instance.cpp | |
@@ -254,9 +254,12 @@ void ScriptInstance::GameLoop() | |
} | |
} | |
-void ScriptInstance::CollectGarbage() const | |
+void ScriptInstance::CollectGarbage() | |
{ | |
- if (this->is_started && !this->IsDead()) this->engine->CollectGarbage(); | |
+ if (this->is_started && !this->IsDead()) { | |
+ ScriptObject::ActiveInstance active(this); | |
+ this->engine->CollectGarbage(); | |
+ } | |
} | |
/* static */ void ScriptInstance::DoCommandReturn(ScriptInstance *instance) | |
diff --git a/src/script/script_instance.hpp b/src/script/script_instance.hpp | |
index 4709c44e2..7db4f5ea8 100644 | |
--- a/src/script/script_instance.hpp | |
+++ b/src/script/script_instance.hpp | |
@@ -68,7 +68,7 @@ public: | |
/** | |
* Let the VM collect any garbage. | |
*/ | |
- void CollectGarbage() const; | |
+ void CollectGarbage(); | |
/** | |
* Get the storage of this script. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment