mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-19 15:03:45 +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
828bb63891
commit
201ec04caa
@ -27,11 +27,12 @@
|
||||
#include "allheaders.h"
|
||||
#include "baseapi.h"
|
||||
#include "basedir.h"
|
||||
#include "dict.h"
|
||||
#include "openclwrapper.h"
|
||||
#include "osdetect.h"
|
||||
#include "renderer.h"
|
||||
#include "strngs.h"
|
||||
#include "tprintf.h"
|
||||
#include "openclwrapper.h"
|
||||
#include "osdetect.h"
|
||||
|
||||
#if defined(HAVE_TIFFIO_H) && defined(_WIN32)
|
||||
|
||||
@ -422,6 +423,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