mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-20 15:59:11 +08:00
Fix deadlock in lstmtraing. (#3488)
This commit is contained in:
parent
767fb5a177
commit
12e0fb4e01
@ -435,15 +435,17 @@ void DocumentData::LoadPageInBackground(int index) {
|
||||
if (IsPageAvailable(index, &page)) {
|
||||
return;
|
||||
}
|
||||
std::lock_guard<std::mutex> lock(pages_mutex_);
|
||||
if (pages_offset_ == index) {
|
||||
return;
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(pages_mutex_);
|
||||
if (pages_offset_ == index) {
|
||||
return;
|
||||
}
|
||||
pages_offset_ = index;
|
||||
for (auto page : pages_) {
|
||||
delete page;
|
||||
}
|
||||
pages_.clear();
|
||||
}
|
||||
pages_offset_ = index;
|
||||
for (auto page : pages_) {
|
||||
delete page;
|
||||
}
|
||||
pages_.clear();
|
||||
if (thread.joinable()) {
|
||||
thread.join();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user