Fix pausing when background process is scheduled but wasn't started yet

This commit is contained in:
Alessandro Ranellucci 2014-07-12 11:52:19 +02:00
parent b8a629f0b6
commit edc7fd2915

View file

@ -807,7 +807,7 @@ sub async_apply_config {
# pause process thread before applying new config
# since we don't want to touch data that is being used by the threads
Slic3r::pause_threads();
$self->pause_background_process;
# apply new config
my $invalidated = $self->{print}->apply_config($self->GetFrame->config);
@ -818,7 +818,7 @@ sub async_apply_config {
# kill current thread if any
$self->stop_background_process;
} else {
Slic3r::resume_threads();
$self->resume_background_process;
}
# schedule a new process thread in case it wasn't running
@ -892,6 +892,26 @@ sub stop_background_process {
}
}
sub pause_background_process {
my ($self) = @_;
if ($self->{process_thread} || $self->{export_thread}) {
$self->pause_background_process;
} elsif (defined $self->{apply_config_timer} && $self->{apply_config_timer}->IsRunning) {
$self->{apply_config_timer}->Stop;
}
}
sub resume_background_process {
my ($self) = @_;
if ($self->{process_thread} || $self->{export_thread}) {
$self->resume_background_process;
} else {
$self->schedule_background_process;
}
}
sub export_gcode {
my $self = shift;
@ -1242,7 +1262,7 @@ sub object_settings_dialog {
object => $self->{objects}[$obj_idx],
model_object => $model_object,
);
Slic3r::pause_threads();
$self->pause_background_process;
$dlg->ShowModal;
# update thumbnail since parts may have changed
@ -1256,7 +1276,7 @@ sub object_settings_dialog {
$self->{print}->reload_object($obj_idx);
$self->schedule_background_process;
} else {
Slic3r::resume_threads();
$self->resume_background_process;
}
}