Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVojtech Bubnik <bubnikv@gmail.com>2021-01-07 19:38:56 +0300
committerVojtech Bubnik <bubnikv@gmail.com>2021-01-07 19:38:56 +0300
commit71808dc006e7e664f79af5ff26e29d21fcdff013 (patch)
treec222df5a2260bf9aba01c580c6b9dbf5262e66c8
parent2ad4447035548378860ad45d4c649ce5ad06ad50 (diff)
boost::process::spawn() sets SIGINT to SIGIGN, which collides with boost::process waiting for a child to finish!
https://jmmv.dev/2008/10/boostprocess-and-sigchld.html Thus reset the SIGINT to its default, so that posix waitpid() and similar continue to work. Fixes Crash on Eject in Second Instance on macOS #5507
-rw-r--r--src/slic3r/Utils/Process.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/slic3r/Utils/Process.cpp b/src/slic3r/Utils/Process.cpp
index bc6961f9a..1199e5e76 100644
--- a/src/slic3r/Utils/Process.cpp
+++ b/src/slic3r/Utils/Process.cpp
@@ -17,6 +17,7 @@
// For starting another PrusaSlicer instance on OSX.
// Fails to compile on Windows on the build server.
#ifdef __APPLE__
+ #include <signal.h>
#include <boost/process/spawn.hpp>
#include <boost/process/args.hpp>
#endif
@@ -78,6 +79,11 @@ static void start_new_slicer_or_gcodeviewer(const NewSlicerInstanceType instance
if (instance_type == NewSlicerInstanceType::Slicer && single_instance)
args.emplace_back("--single-instance");
boost::process::spawn(bin_path, args);
+ // boost::process::spawn() sets SIGINT to SIGIGN, which collides with boost::process waiting for a child to finish!
+ // https://jmmv.dev/2008/10/boostprocess-and-sigchld.html
+ // Thus reset the SIGINT to its default, so that posix waitpid() and similar continue to work.
+ // Fixes Crash on Eject in Second Instance on macOS #5507
+ signal(SIGINT, SIG_DFL);
}
catch (const std::exception& ex) {
BOOST_LOG_TRIVIAL(error) << "Failed to spawn a new slicer \"" << bin_path.string() << "\": " << ex.what();