mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-18 06:30:14 +08:00
Fix order of destructor calls for DawgCache and TessBaseAPI
TessBaseAPI must release its cache use before DawgCache is destroyed. Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
f37f858c99
commit
78142593d2
@ -27,6 +27,7 @@
|
||||
#include "allheaders.h"
|
||||
#include "baseapi.h"
|
||||
#include "basedir.h"
|
||||
#include "dict.h"
|
||||
#include "openclwrapper.h"
|
||||
#include "osdetect.h"
|
||||
#include "renderer.h"
|
||||
@ -425,6 +426,11 @@ int main(int argc, char** argv) {
|
||||
|
||||
PERF_COUNT_START("Tesseract:main")
|
||||
|
||||
// Call GlobalDawgCache here to create the global DawgCache object before
|
||||
// the TessBaseAPI object. This fixes the order of destructor calls:
|
||||
// first TessBaseAPI must be destructed, DawgCache must be the last object.
|
||||
tesseract::Dict::GlobalDawgCache();
|
||||
|
||||
// Avoid memory leak caused by auto variable when exit() is called.
|
||||
static tesseract::TessBaseAPI api;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user