Export to GitHub

subtitleedit - issue #143

Bckground thread for ocr vobsub never stops


Posted on May 7, 2013 by Swift Ox

when debugging last sources downloaded I noticed that cancelling ocr run (when importing vobsubs) doesn't stop the tesseract thread

What steps will reproduce the problem? 1. import vobsub 2. use ocr by tesseract 3. start ocr 4. cancel ocr

What is the expected output? What do you see instead? in the tempdir/ the png files (given to tesseract exe) are still created and deleted although we have stopped the job

What version of the product are you using? On what operating system? SE334 on windows 7 x64

Patchs to apply on SE334-CSharp-SourceCode\Forms\VobSubOcr.cs :

private void ButtonStopClick(object sender, EventArgs e) { _abort = true; _tesseractThread.CancelAsync(); buttonStop.Enabled = false; Application.DoEvents(); progressBar1.Visible = false; labelStatus.Text = string.Empty; }

void TesseractThreadDoWork(object sender, DoWorkEventArgs e) { var bitmap = (Bitmap)e.Argument; if (_tesseractAsyncIndex >= 0 && _tesseractAsyncIndex < _tesseractAsyncStrings.Length) { if (string.IsNullOrEmpty(_tesseractAsyncStrings[_tesseractAsyncIndex]) && bitmap != null) _tesseractAsyncStrings[_tesseractAsyncIndex] = Tesseract3DoOcrViaExe(bitmap, _languageId, "-psm 6"); // 6 = Assume a single uniform block of text.);

            if (((BackgroundWorker)sender).CancellationPending)
            {
                e.Cancel = true;
            }
        }
    }

Comment #1

Posted on Feb 4, 2014 by Quick Dog

SE has moved to GitHub - please re-add this issue at GitHub if it's still important :) https://github.com/SubtitleEdit/subtitleedit/issues

Status: New

Labels:
Type-Defect Priority-Medium