diff --git a/lib/Slic3r.pm b/lib/Slic3r.pm index 140eb738d..04e8ed72a 100644 --- a/lib/Slic3r.pm +++ b/lib/Slic3r.pm @@ -190,10 +190,12 @@ sub thread_cleanup { sub kill_all_threads { # detach any running thread created in the current one + my @killed = (); foreach my $thread (grep defined($_), map threads->object($_), @threads) { $thread->kill('KILL'); - $thread->detach; + push @killed, $thread; } + $_->join for @killed; # block until threads are killed @threads = (); }