diff --git a/lib/Slic3r.pm b/lib/Slic3r.pm index 37f242e72..d759d1b34 100644 --- a/lib/Slic3r.pm +++ b/lib/Slic3r.pm @@ -103,11 +103,14 @@ sub spawn_thread { my $parent_tid = threads->tid; lock @threads; + # Set up a default handler for preventing crashes in case signals are received before + # thread sets its handlers. + $SIG{'STOP'} = sub {}; + @_ = (); my $thread = threads->create(sub { @my_threads = (); - Slic3r::debugf "Starting thread %d (parent: %d)...\n", threads->tid, $parent_tid; local $SIG{'KILL'} = sub { Slic3r::debugf "Exiting thread %d...\n", threads->tid; $parallel_sema->up if $parallel_sema; @@ -119,6 +122,7 @@ sub spawn_thread { $pause_sema->down; $pause_sema->up; }; + Slic3r::debugf "Starting thread %d (parent: %d)...\n", threads->tid, $parent_tid; $cb->(); }); push @my_threads, $thread->tid;