Bugfix: error during skein freezed the GUI

This commit is contained in:
Alessandro Ranellucci 2011-10-03 17:41:45 +02:00
parent 076087af2e
commit 71a373e437

View file

@ -225,6 +225,7 @@ sub new {
sub do_slice { sub do_slice {
my $self = shift; my $self = shift;
my $process_dialog;
eval { eval {
# validate configuration # validate configuration
Slic3r::Config->validate; Slic3r::Config->validate;
@ -236,7 +237,7 @@ sub do_slice {
my $input_file_basename = basename($input_file); my $input_file_basename = basename($input_file);
# show processbar dialog # show processbar dialog
my $process_dialog = Wx::ProgressDialog->new('Slicing...', "Processing $input_file_basename...", $process_dialog = Wx::ProgressDialog->new('Slicing...', "Processing $input_file_basename...",
100, $self, wxPD_APP_MODAL); 100, $self, wxPD_APP_MODAL);
$process_dialog->Pulse; $process_dialog->Pulse;
my $skein = Slic3r::Skein->new( my $skein = Slic3r::Skein->new(
@ -244,12 +245,14 @@ sub do_slice {
); );
$skein->go; $skein->go;
$process_dialog->Destroy; $process_dialog->Destroy;
undef $process_dialog;
Wx::MessageDialog->new($self, "$input_file_basename was successfully sliced.", 'Done!', Wx::MessageDialog->new($self, "$input_file_basename was successfully sliced.", 'Done!',
wxOK | wxICON_INFORMATION)->ShowModal; wxOK | wxICON_INFORMATION)->ShowModal;
}; };
if (my $err = $@) { if (my $err = $@) {
$process_dialog->Destroy if $process_dialog;
Wx::MessageDialog->new($self, $err, 'Error', wxOK | wxICON_ERROR)->ShowModal; Wx::MessageDialog->new($self, $err, 'Error', wxOK | wxICON_ERROR)->ShowModal;
} }
} }