This may be a bug so please file a bug report with a test case (btw, you mentioned you can’t add attachments to bug reports, is this correct? Rob, can we fix this?).
The idea behind ocrInit and ocrCleanup is indeed to create and destroy the OCR environment so they should, in theory, be able to be called multiple times as long as they are properly paired and not nested.
I’ll let Vincent answer on whether or not ocrCleanup will try to cleanup events/DBs that have already been cleaned up but I do not think so so I think the problem may be elsewhere.
From: email@example.com [mailto:firstname.lastname@example.org] On Behalf Of Benoit Meister
Sent: Wednesday, January 09, 2013 4:30 PM
To: Technical discussion about OCR
Subject: [OCR-dev] What does ocrCleanup clean up ?
I have a function that calls ocrInit and ocrCleanup and this function gets called several times.
I'm cleaning up all sorts of things at each call, including events (since they're sticky), DBs, etc.
But I don't know if I should do that or if I'm conflicting with ocrCleanup.
I get segfaults at the second call of the function, when it first calls ocrEdtCreate, which is why I'm suspecting an interference problem.