tags 663584 pending thanks Looking at the code, this was caused by File::Copy throwing an error - i.e. I assume that you ran out of space in $TMPDIR, or whereever you have specified in Edit/Preferences.
The attached patch should at least stop the paste process corrupting the document. I agree, however, that this shouldn't prevent you saving - although if you are short on space, there might not be room to convert files for saving. Needless to say - I can't reproduce any of this. I suppose I need to start using something like http://packages.debian.org/sid/libfiu-dev I guess it would be good if gscan2pdf checked TMPDIR regularly and as soon as there wasn't room for more than another, say, 2 of the largest pages, then it should display an warning message. Would this need to be optional? Is a regular df much of a performance hit?
commit 2d27d02cad0242906a4f57297c0644d43ef2dd17 Author: Jeffrey Ratcliffe <jeffrey.ratcli...@gmail.com> Date: Tue Mar 13 08:15:20 2012 +0100 Don't continue pasting and corrupt the document if the file cannot be copied diff --git a/bin/gscan2pdf b/bin/gscan2pdf index 3b808e7..3a44110 100755 --- a/bin/gscan2pdf +++ b/bin/gscan2pdf @@ -6174,27 +6174,34 @@ sub copy_selection { # Paste the selection sub paste_selection { + + # We only add pages if the list of thumbnails has the focus if ( $slist->has_focus ) { my @page = $slist->get_selected_indices; - # Create a new image file + # Create a new image file for each page in the clipboard for (@clipboard) { my $suffix; $suffix = $1 if ( $_->[2] =~ /(\.\w*)$/ ); my $new = File::Temp->new( DIR => $session, SUFFIX => $suffix ); - copy( $_->[2], $new ) - or show_message_dialog( $window, 'error', 'close', - $d->get('Error pasting image') ); + unless ( copy( $_->[2], $new ) ) { + show_message_dialog( $window, 'error', 'close', + $d->get('Error pasting image') ); + return; + } $_->[2] = $new; } # Block the row-changed signal whilst adding the scan (row) and sorting it. $slist->get_model->signal_handler_block( $slist->{row_changed_signal} ); + # If a page is selected, then insert the pasted page immediately afterwards if (@page) { splice @{ $slist->{data} }, $page[0] + 1, 0, @clipboard; @page = ( $page[0] + 1 ); } + + # Otherwise append the page to the end else { push @{ $slist->{data} }, @clipboard; @page = ( $#{ $slist->{data} } - $#clipboard );