Clear QueryCursor state between exec calls

This commit is contained in:
Max Brunsfeld 2020-03-26 16:10:39 -07:00
parent 8eac81b8df
commit 322b311c2c
3 changed files with 6 additions and 0 deletions

View file

@ -248,6 +248,9 @@ static CaptureListPool capture_list_pool_new() {
static void capture_list_pool_reset(CaptureListPool *self) {
self->usage_map = UINT32_MAX;
for (unsigned i = 0; i < 32; i++) {
array_clear(&self->list[i]);
}
}
static void capture_list_pool_delete(CaptureListPool *self) {

View file

@ -143,6 +143,8 @@ pub extern "C" fn ts_tagger_tag(
let tag = if let Ok(tag) = tag {
tag
} else {
buffer.tags.clear();
buffer.docs.clear();
return TSTagsError::Timeout;
};

View file

@ -212,6 +212,7 @@ impl TagsContext {
self.parser
.set_language(config.language)
.map_err(|_| Error::InvalidLanguage)?;
self.parser.reset();
unsafe { self.parser.set_cancellation_flag(cancellation_flag) };
let tree = self.parser.parse(source, None).ok_or(Error::Cancelled)?;