Also hold global lock when constructing a tokenizer and setting its current_ui_language

This commit is contained in:
Kovid Goyal 2021-06-18 21:40:14 +05:30
parent d9b773bd19
commit ef78b19912
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -238,7 +238,7 @@ public:
int constructor_error; int constructor_error;
Tokenizer(const char **args, int nargs) : Tokenizer(const char **args, int nargs) :
remove_diacritics(true), diacritics_remover(), remove_diacritics(true), diacritics_remover(),
byte_offsets(), token_buf(), current_ui_language(ui_language), byte_offsets(), token_buf(), current_ui_language(""),
current_callback(NULL), current_callback_ctx(NULL), iterators(), current_callback(NULL), current_callback_ctx(NULL), iterators(),
constructor_error(SQLITE_OK) constructor_error(SQLITE_OK)
@ -259,6 +259,8 @@ public:
remove_diacritics = false; remove_diacritics = false;
} }
} }
std::lock_guard<std::mutex> lock(global_mutex);
current_ui_language = ui_language;
} }
int tokenize(void *callback_ctx, int flags, const char *text, int text_sz, token_callback_func callback) { int tokenize(void *callback_ctx, int flags, const char *text, int text_sz, token_callback_func callback) {