Blob Blame History Raw
--- a/bin/gscan2pdf	
+++ a/bin/gscan2pdf	
@@ -6040,9 +6040,18 @@ sub scanimage {
        # If the scan can't be loaded then blow the scanning dialog away and
        # show an error
        my $rotate = $1 % 2 ? $rfacing : $rreverse;
-       my $index = import_scan( "out$1.pnm", $1 * $step + $offset,
-        $SETTING{resolution}, TRUE, $rotate, $unpaper, $ocr );
-       $num_scans++;
+
+       # Timer will run until callback returns false
+       my $timer = Glib::Timeout->add(
+        100,
+        sub {
+         return TRUE if ( -e "out$1.pnm" );
+         my $index = import_scan( "out$1.pnm", $1 * $step + $offset,
+          $SETTING{resolution}, TRUE, $rotate, $unpaper, $ocr );
+         $num_scans++;
+         return FALSE;
+        }
+       );
       }
       elsif ( $line =~
        /Scanner warming up - waiting \d* seconds|wait for lamp warm-up/ )