diff --git a/lib/Slic3r.pm b/lib/Slic3r.pm index 2668f7229..73869c07b 100644 --- a/lib/Slic3r.pm +++ b/lib/Slic3r.pm @@ -172,6 +172,11 @@ sub parallelize { sub thread_cleanup { return if !$Slic3r::have_threads; + if (threads->tid == 0) { + warn "Calling thread_cleanup() from main thread\n"; + return; + } + # prevent destruction of shared objects no warnings 'redefine'; *Slic3r::BridgeDetector::DESTROY = sub {}; diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index eee5061ee..1344aecaf 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -291,7 +291,6 @@ sub new { EVT_COMMAND($self, -1, $PROCESS_COMPLETED_EVENT, sub { my ($self, $event) = @_; $self->on_process_completed($event->GetData); - Slic3r::thread_cleanup(); }); if ($Slic3r::have_threads) {