summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-07-07 00:09:46 +0200
committerGitHub <noreply@github.com>2020-07-07 00:09:46 +0200
commitb8b634d2e6effeea85f832451d8deff57b62df66 (patch)
treea140e1518e3147a83034add8d82685e6962415cb /modules
parentf70615632938e6ac35e39418549980c6a2e3748b (diff)
parente9c8bf5e1b61c2bb7f26820b8805c0d69d9d5621 (diff)
Merge pull request #40171 from SkyLucilfer/PotGenerationFixLeak
Fix GDScriptEditorTranslationParserPlugin instance leak
Diffstat (limited to 'modules')
-rw-r--r--modules/gdscript/register_types.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp
index 53e760ffa7..388df63dba 100644
--- a/modules/gdscript/register_types.cpp
+++ b/modules/gdscript/register_types.cpp
@@ -55,6 +55,8 @@ Ref<ResourceFormatSaverGDScript> resource_saver_gd;
#include "language_server/gdscript_language_server.h"
#endif // !GDSCRIPT_NO_LSP
+Ref<GDScriptEditorTranslationParserPlugin> gdscript_translation_parser_plugin;
+
class EditorExportGDScript : public EditorExportPlugin {
GDCLASS(EditorExportGDScript, EditorExportPlugin);
@@ -167,7 +169,6 @@ void register_gdscript_types() {
ScriptEditor::register_create_syntax_highlighter_function(GDScriptSyntaxHighlighter::create);
EditorNode::add_init_callback(_editor_init);
- Ref<GDScriptEditorTranslationParserPlugin> gdscript_translation_parser_plugin;
gdscript_translation_parser_plugin.instance();
EditorTranslationParser::get_singleton()->add_parser(gdscript_translation_parser_plugin, EditorTranslationParser::STANDARD);
#endif // TOOLS_ENABLED
@@ -185,4 +186,9 @@ void unregister_gdscript_types() {
ResourceSaver::remove_resource_format_saver(resource_saver_gd);
resource_saver_gd.unref();
+
+#ifdef TOOLS_ENABLED
+ EditorTranslationParser::get_singleton()->remove_parser(gdscript_translation_parser_plugin, EditorTranslationParser::STANDARD);
+ gdscript_translation_parser_plugin.unref();
+#endif // TOOLS_ENABLED
}