diff options
author | Bartosz Bielecki <bielecki.b@gmail.com> | 2022-12-05 14:45:19 +0100 |
---|---|---|
committer | Bartosz Bielecki <bielecki.b@gmail.com> | 2022-12-06 10:01:18 +0100 |
commit | 2af4f7f76256623d84fbe54a7cecbc96e7fd24c4 (patch) | |
tree | a3bd03d8569bdb2b6c342398c042633bcec889b6 /modules | |
parent | d759210f5281e6a8e813b47cbca0f41ce9ebbdf1 (diff) |
Keep GDScriptAnalyzer alive for whole parse()
Analyzed data is allocated by Parser but kept as a reference in the cache
which in turn is held by the Analyzer. If Analyzer goes away Parser is left
with a tree of dangling references.
Code is analogous to all other usages of Analyzer + Parser pair.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gdscript/language_server/gdscript_extend_parser.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/gdscript/language_server/gdscript_extend_parser.cpp b/modules/gdscript/language_server/gdscript_extend_parser.cpp index de3becbaf8..e442bf8159 100644 --- a/modules/gdscript/language_server/gdscript_extend_parser.cpp +++ b/modules/gdscript/language_server/gdscript_extend_parser.cpp @@ -844,8 +844,9 @@ Error ExtendGDScriptParser::parse(const String &p_code, const String &p_path) { lines = p_code.split("\n"); Error err = GDScriptParser::parse(p_code, p_path, false); + GDScriptAnalyzer analyzer(this); + if (err == OK) { - GDScriptAnalyzer analyzer(this); err = analyzer.analyze(); } update_diagnostics(); |