Changeset 4764


Ignore:
Timestamp:
Jan 27, 2010, 5:32:12 PM (11 years ago)
Author:
ronosman
Message:

Bug 1410 fixed : pLoader may crash when adding or uploading photo is canceled by user.

Location:
extensions/pLoader/trunk/src/Uploader
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • extensions/pLoader/trunk/src/Uploader/GUI/Frame.pm

    r4763 r4764  
    13011301                title => gettext("Image processing progress information"),
    13021302                bt_label => gettext("Cancel image processing"),
    1303                 bt_close_label => gettext("Close"),
     1303                bt_close_label => gettext("Close"),
     1304                stop_processing => sub { $self->imagelist->stop_processing(1); Wx::Yield(); },
    13041305             }
    13051306        )       
     
    17521753                    bt_label => gettext("Cancel upload"),
    17531754                    bt_close_label => gettext("Close"),
     1755                    stop_processing => sub { $self->imagelist->stop_processing(1); Wx::Yield(); },
    17541756                 }
    17551757            )       
  • extensions/pLoader/trunk/src/Uploader/GUI/wxImageProcessingProgressDlg.pm

    r4718 r4764  
    5252           cancelled
    5353           bt_close_label
     54           stop_processing
    5455      /
    5556);
     
    7071             wxDIALOG_NO_PARENT|
    7172             wxDEFAULT_DIALOG_STYLE|
    72 
    7373             wxMAXIMIZE_BOX|
    74              wxMINIMIZE_BOX| 
     74             wxMINIMIZE_BOX|
    7575             wxSTAY_ON_TOP
    7676
     
    9595    $self->bt_close_label(
    9696        $params->{bt_close_label}||'Close'
     97    );
     98
     99    $self->stop_processing(
     100        $params->{stop_processing}
    97101    );
    98102
     
    149153   
    150154    $self->cancelled(1);
     155    $self->stop_processing->();
    151156    $self->Destroy;
    152157 
  • extensions/pLoader/trunk/src/Uploader/GUI/wxImageReuploadDlg.pm

    r4750 r4764  
    2525             wxID_CANCEL
    2626             wxID_OK
    27              wxGREEN
    2827             wxSTAY_ON_TOP
    2928         /;
     
    3130use base qw/Wx::Dialog Uploader::GUI::DlgCommon/;
    3231use Wx::Event qw/
    33                     EVT_UPDATE_UI
    3432                    EVT_BUTTON
    3533                    EVT_CLOSE
  • extensions/pLoader/trunk/src/Uploader/ImageList.pm

    r4760 r4764  
    126126                reupload_not_ask
    127127                display_mode
     128                stop_processing
    128129     /
    129130);
     
    218219    my ( $self, $files ) = @_;
    219220
     221    $self->stop_processing(0);
     222
    220223    $self->new_files( $files );
    221224
     
    227230    my $errors = 0;
    228231
    229     map {
    230         my $info = $self->_read_exif_metatdata($_->{ANSIPathName});
    231            my $is_new_image = $self->_add_image($_, $info, $i);   
     232    foreach my $file ( @{$files} ) {
     233        my $info = $self->_read_exif_metatdata($file->{ANSIPathName});
     234           my $is_new_image = $self->_add_image($file, $info, $i);   
    232235        $self->SetCurrentImage($i);
    233236        $self->_set_current_image_filepaths();
     
    254257        $self->count($count);
    255258        $self->SetNewFilesViewerRefreshCallback->();
    256     }
    257     @{$files};
     259        last if $self->stop_processing;
     260    }
     261
    258262    $self->SetNewFilesDisplayEndInfoCallback->(
    259263        sprintf(
     
    741745
    742746sub UploadSelection {
    743     my ( $self ) = @_;   
     747    my ( $self ) = @_;
     748
     749    $self->stop_processing(0);
    744750
    745751    my $viewer_callback = $self->UploadImagesViewerCallback ;
     
    795801        # keep site_high_file because it can be the original !!!
    796802        $self->_remove_resized_from_cache;
    797     }
     803
     804        last if $self->stop_processing;
     805    }
     806
     807    $self->stop_processing(0);
    798808
    799809    if($self->remove_uploaded_from_selection){
    800810        $self->_remove_image_list($self->uploaded_images);
     811        # clear thumbnail imagelistctrl
    801812        $viewer_callback->();
    802813    }
    803814
    804815    $self->_upload_selection_final_log();
     816
    805817}
    806818
     
    881893            $self->upload_msg
    882894        );
    883         # set current image thumbnail
    884           # update upload progress dialog
    885         #$self->progressbar_refresh->($value);
    886895    };
    887896    # user cancelled : dialog box is destroyed
     
    912921    my ( $self ) = @_;
    913922
     923    return if $self->stop_processing;
     924
    914925    $self->_set_upload_msg(gettext("Uploading"));
    915926    $self->_upload_progress(0);
     
    918929    my ( $status, $status_msg, $content ) = $self->pwg->UploadImage(
    919930        {
    920             yield=>$self->YieldCallback,
    921             bar=>$self->progressbar_refresh,
    922             msg=>$self->progress_msg_refresh,
    923             msg_details=>$self->progress_msg_details_refresh,
    924             resized_msg=>gettext("Uploading resized"),
    925             thumbnail_msg=>gettext("Uploading thumbnail"),
    926             highdef_msg=>gettext("Uploading high definition"),
    927             checksum_msg=>gettext("Checksum for"),
    928             original_sum=>$self->current_image->file_sum,
     931            yield           => $self->YieldCallback,
     932            bar             => $self->progressbar_refresh,
     933            msg             => $self->progress_msg_refresh,
     934            msg_details     => $self->progress_msg_details_refresh,
     935            resized_msg     => gettext("Uploading resized"),
     936            thumbnail_msg   => gettext("Uploading thumbnail"),
     937            highdef_msg     => gettext("Uploading high definition"),
     938            checksum_msg    => gettext("Checksum for"),
     939            original_sum    => $self->current_image->file_sum,
     940            stop_processing => $self->stop_processing,
    929941        }
    930942    );
  • extensions/pLoader/trunk/src/Uploader/PWG/WebServices.pm

    r4747 r4764  
    271271sub UploadImage {
    272272    my ( $self, $progress ) = @_;
     273   
     274    return if $progress->{stop_processing};
    273275
    274276    $self->image_id(
     
    382384        level         => $self->privacy_level ? 2**($self->privacy_level - 1) : 0,
    383385    };
    384     print Dumper $form;
     386
    385387    my ( $status, $status_line ) = $self->_execute_post($form);
    386388    my $hresult = $self->_json_response_content;
Note: See TracChangeset for help on using the changeset viewer.