Skip to content

Commit

Permalink
Keep GDScriptAnalyzer alive for whole parse()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
red1939 committed Dec 6, 2022
1 parent d759210 commit 2af4f7f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/gdscript/language_server/gdscript_extend_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 2af4f7f

Please sign in to comment.