X Tutup
Skip to content

LSP: Reuse stale parsers in request#114791

Merged
akien-mga merged 1 commit intogodotengine:masterfrom
HolonProduction:lsp/reuse-stale-parsers-in-request
Jan 9, 2026
Merged

LSP: Reuse stale parsers in request#114791
akien-mga merged 1 commit intogodotengine:masterfrom
HolonProduction:lsp/reuse-stale-parsers-in-request

Conversation

@HolonProduction
Copy link
Member

Fixes #114729

When a parser is requested for a script which is not opened in the external editor, a new parser for the script gets created and the old parser for the script gets freed. The idea was to always refresh those from disk since we don't know when they change.

However if a pointer to the old parsers was stored and then a parser was requested for the path again, the old parser would be freed even though there still is a pointer to it.

This PR changes the cleanup logic for stale parsers to reuse them as long as we are in the same request. All stale parsers are cleaned up after the the request finished. This prevents those heap-use-after-free issues.

@akien-mga akien-mga added the bug label Jan 9, 2026
@akien-mga
Copy link
Member

Unit tests seem to fail.

@HolonProduction HolonProduction force-pushed the lsp/reuse-stale-parsers-in-request branch from 43c5807 to 9d90a67 Compare January 9, 2026 14:45
@akien-mga akien-mga merged commit dc19eb6 into godotengine:master Jan 9, 2026
20 checks passed
@akien-mga
Copy link
Member

Thanks!

@HolonProduction HolonProduction deleted the lsp/reuse-stale-parsers-in-request branch January 26, 2026 13:36
rivie13 pushed a commit to rivie13/Phoenix-Agentic-Engine that referenced this pull request Feb 16, 2026
…stale-parsers-in-request

LSP: Reuse stale parsers in request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LSP command Goto References causes a segfault on 4.6 Beta 3 (with NeoVim)

2 participants

X Tutup