tag 622844 +patch +upstream thanks First a little correction to my initial description: unpaper and gocr were actually run, I just missed that.
I've narrowed down the problem a bit:
gscan2pdf displays an error dialog as long as the status in
Gscan2pdf::Backend::Sane::scan_pages is not SANE_STATUS_GOOD - which
seems to be no problem as $self->{status} gets set to SANE_STATUS_GOOD
if it is SANE_STATUS_EOF a few lines before. ($self->{status} gets set
by _thread_scan_page_to_fh to the value of $Sane::STATUS to share it
between the threads).
However, in my case I trapped a race condition where
_thread_scan_page_to_fh resets $self->{status} to $Sane::STATUS (which
is SANE_STATUS_EOF) between
| # Check status of scan
| if ($_self->{status} == SANE_STATUS_GOOD
| or $_self->{status} == SANE_STATUS_EOF )
| {
| $_self->{status} = SANE_STATUS_GOOD;
| $page_good_callback->($n);
| }
and
| $error_callback->( Sane::strstatus( $_self->{status} ) )
| unless (
| $_self->{status} == SANE_STATUS_GOOD
| or ...
I have attached a patch that changes scan_pages to not modify
$self->{status} but rather checks for SANE_STATUS_EOF too where it is
needed.
Sebastian
diff --git a/bin/gscan2pdf b/bin/gscan2pdf
index c703b5c..cd488f4 100755
--- a/bin/gscan2pdf
+++ b/bin/gscan2pdf
@@ -12675,19 +12675,20 @@ sub scan_pages {
if ($_self->{status} == SANE_STATUS_GOOD
or $_self->{status} == SANE_STATUS_EOF )
{
- $_self->{status} = SANE_STATUS_GOOD;
$page_good_callback->($n);
}
# Stop the process unless everything OK and more scans required
unless ( ( $npages == -1 or --$npages )
- and $_self->{status} == SANE_STATUS_GOOD )
+ and ( $_self->{status} == SANE_STATUS_GOOD
+ or $_self->{status} == SANE_STATUS_EOF ) )
{
_enqueue_request('cancel');
$dialog->destroy;
$error_callback->( Sane::strstatus( $_self->{status} ) )
unless (
$_self->{status} == SANE_STATUS_GOOD
+ or $_self->{status} == SANE_STATUS_EOF
or ( $_self->{status} == SANE_STATUS_NO_DOCS
and $npages < 1
and $n2 > 1 )
signature.asc
Description: Digital signature

