Release tree when changing document's language
This commit is contained in:
parent
b1f4b046f5
commit
a74bf7ece1
1 changed files with 4 additions and 1 deletions
|
|
@ -34,7 +34,10 @@ const TSLanguage *ts_document_language(TSDocument *self) {
|
|||
void ts_document_set_language(TSDocument *self, const TSLanguage *language) {
|
||||
ts_document_invalidate(self);
|
||||
self->parser.language = language;
|
||||
self->tree = NULL;
|
||||
if (self->tree) {
|
||||
ts_tree_release(self->tree);
|
||||
self->tree = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
TSDebugger ts_document_debugger(const TSDocument *self) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue