From ea57f1301dc59484fa351ed4efbac2e4f32becb6 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Sun, 7 Feb 2010 10:39:10 +0000 Subject: [PATCH] Restore old signal handlers after ours have fired once --- src/Main.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Main.cpp b/src/Main.cpp index ea5bc7f..a5e6010 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -31,11 +31,19 @@ using namespace boost::filesystem; namespace { IWindowPtr window; + struct sigaction oldSIGINT; + void clearSignalHandlers() + { + sigaction(SIGINT, &oldSIGINT, NULL); + } + void SIGINT_handler(int unused) { log() << "Caught SIGINT"; ::window->quit(); + + clearSignalHandlers(); } void setupSignalHandlers() @@ -45,7 +53,7 @@ namespace { sa.sa_flags = 0; sigemptyset(&sa.sa_mask); - sigaction(SIGINT, &sa, NULL); + sigaction(SIGINT, &sa, &oldSIGINT); } } -- 2.39.2