From 901269a2321e50fb71f8c32a9abf7ff4550e4c2f Mon Sep 17 00:00:00 2001 From: Zhilkin Serg Date: Fri, 27 Dec 2024 16:25:51 +0300 Subject: [PATCH 1/6] Revert 78379 --- src/handle_action.cpp | 8 +++++--- src/main_menu.cpp | 8 ++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/handle_action.cpp b/src/handle_action.cpp index 34e395225f3fa..683b0187df201 100644 --- a/src/handle_action.cpp +++ b/src/handle_action.cpp @@ -2834,9 +2834,11 @@ bool game::do_regular_action( action_id &act, avatar &player_character, break; case ACTION_SAVE: - if( save() ) { - player_character.set_moves( 0 ); - uquit = QUIT_SAVED; + if( query_yn( _( "Save and quit?" ) ) ) { + if( save() ) { + player_character.set_moves( 0 ); + uquit = QUIT_SAVED; + } } break; diff --git a/src/main_menu.cpp b/src/main_menu.cpp index c079293739e59..9a2ae6a275c5c 100644 --- a/src/main_menu.cpp +++ b/src/main_menu.cpp @@ -884,8 +884,12 @@ bool main_menu::opening_screen() // also check special keys if( action == "QUIT" ) { #if !defined(EMSCRIPTEN) - g->uquit = QUIT_EXIT; - return false; + g->uquit = QUIT_EXIT_PENDING; + if( query_yn( _( "Really quit?" ) ) ) { + g->uquit = QUIT_EXIT; + return false; + } + g->uquit = QUIT_NO; #endif } else if( action == "LEFT" || action == "PREV_TAB" || action == "RIGHT" || action == "NEXT_TAB" ) { sel_line = 0; From 08c4666026a96653c7d97495e0495cc248fed19e Mon Sep 17 00:00:00 2001 From: Zhilkin Serg Date: Fri, 27 Dec 2024 16:30:27 +0300 Subject: [PATCH 2/6] Revert 77651 --- src/debug.cpp | 2 +- src/do_turn.cpp | 2 +- src/game.cpp | 7 +------ src/game.h | 2 -- src/handle_action.cpp | 4 ++-- src/input_context.cpp | 1 - src/main_menu.cpp | 2 +- src/ui.cpp | 2 +- 8 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/debug.cpp b/src/debug.cpp index 469e8d56f5e0c..ffb26efe52db0 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -386,7 +386,7 @@ static void debug_error_prompt( inp_mngr.set_timeout( 50 ); input_event ievent = inp_mngr.get_input_event(); if( ievent.type == input_event_t::timeout ) { - if( are_we_quitting() ) { + if( g && g->uquit == QUIT_EXIT ) { g->query_exit_to_OS(); } continue; diff --git a/src/do_turn.cpp b/src/do_turn.cpp index 12ec3c7a6e524..4d9571ffdb7bd 100644 --- a/src/do_turn.cpp +++ b/src/do_turn.cpp @@ -103,7 +103,7 @@ namespace turn_handler bool cleanup_at_end() { avatar &u = get_avatar(); - if( are_we_quitting() ) { + if( g->uquit == QUIT_EXIT ) { return true; } if( g->uquit == QUIT_DIED || g->uquit == QUIT_SUICIDE ) { diff --git a/src/game.cpp b/src/game.cpp index 57bb011fc4a19..76c28527a9f63 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -2884,7 +2884,7 @@ bool game::query_exit_to_OS() bool game::is_game_over() { - if( are_we_quitting() ) { + if( uquit == QUIT_EXIT ) { return query_exit_to_OS(); } if( uquit == QUIT_DIED || uquit == QUIT_WATCH ) { @@ -14150,8 +14150,3 @@ global_variables &get_globals() { return g->global_variables_instance; } - -bool are_we_quitting() -{ - return g && ( g->uquit == QUIT_EXIT || g->uquit == QUIT_EXIT_PENDING ); -} diff --git a/src/game.h b/src/game.h index 12b8baff6853c..988832e9f68b8 100644 --- a/src/game.h +++ b/src/game.h @@ -1322,6 +1322,4 @@ namespace cata_event_dispatch void avatar_moves( const tripoint_abs_ms &old_abs_pos, const avatar &u, const map &m ); } // namespace cata_event_dispatch -bool are_we_quitting(); - #endif // CATA_SRC_GAME_H diff --git a/src/handle_action.cpp b/src/handle_action.cpp index 683b0187df201..a1837c2b774a4 100644 --- a/src/handle_action.cpp +++ b/src/handle_action.cpp @@ -336,7 +336,7 @@ input_context game::get_player_input( std::string &action ) creature_tracker &creatures = get_creature_tracker(); do { - if( are_we_quitting() ) { + if( g->uquit == QUIT_EXIT ) { break; } if( bWeatherEffect && get_option( "ANIMATION_RAIN" ) ) { @@ -3143,7 +3143,7 @@ bool game::handle_action() // of location clicked. std::optional mouse_target; - if( are_we_quitting() ) { + if( uquit == QUIT_EXIT ) { return false; } diff --git a/src/input_context.cpp b/src/input_context.cpp index 927363df459bd..bc3bdc9c8d164 100644 --- a/src/input_context.cpp +++ b/src/input_context.cpp @@ -447,7 +447,6 @@ const std::string &input_context::handle_input( const int timeout ) } if( g->uquit == QUIT_EXIT ) { - g->uquit = QUIT_EXIT_PENDING; result = &QUIT; break; } diff --git a/src/main_menu.cpp b/src/main_menu.cpp index 9a2ae6a275c5c..7af6fbcf65089 100644 --- a/src/main_menu.cpp +++ b/src/main_menu.cpp @@ -791,7 +791,7 @@ bool main_menu::opening_screen() #endif while( !start ) { - if( are_we_quitting() ) { + if( g->uquit == QUIT_EXIT ) { return false; } diff --git a/src/ui.cpp b/src/ui.cpp index 66b82a69761bb..99ef13f2dbb37 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -995,7 +995,7 @@ void uilist::query( bool loop, int timeout, bool allow_unfiltered_hotkeys ) ret = entries[selected].retval; } } else if( ( allow_cancel && ret_act == "UILIST.QUIT" ) || - ( are_we_quitting() && ret_act == "QUIT" ) ) { + ( g->uquit == QUIT_EXIT && ret_act == "QUIT" ) ) { ret = UILIST_CANCEL; } else if( ret_act == "TIMEOUT" ) { ret = UILIST_WAIT_INPUT; From df31d1620ed99bd280f3d820ab462f8f88ae5103 Mon Sep 17 00:00:00 2001 From: Zhilkin Serg Date: Fri, 27 Dec 2024 16:30:44 +0300 Subject: [PATCH 3/6] Revert 77457 --- src/debug.cpp | 11 +---------- src/init.cpp | 4 +++- src/main.cpp | 12 ++++++------ src/main_menu.cpp | 2 -- 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/src/debug.cpp b/src/debug.cpp index ffb26efe52db0..ce3ba7fd1998b 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -33,7 +33,6 @@ #include "color.h" #include "cursesdef.h" #include "filesystem.h" -#include "game.h" #include "get_version.h" #include "input.h" #include "loading_ui.h" @@ -383,15 +382,7 @@ static void debug_error_prompt( #endif for( bool stop = false; !stop; ) { ui_manager::redraw(); - inp_mngr.set_timeout( 50 ); - input_event ievent = inp_mngr.get_input_event(); - if( ievent.type == input_event_t::timeout ) { - if( g && g->uquit == QUIT_EXIT ) { - g->query_exit_to_OS(); - } - continue; - } - switch( ievent.get_first_input() ) { + switch( inp_mngr.get_input_event().get_first_input() ) { #if defined(TILES) case 'c': case 'C': diff --git a/src/init.cpp b/src/init.cpp index cec7aacbeae98..ba0ff56238825 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -132,7 +132,9 @@ namespace void check_sigint() { if( g && g->uquit == quit_status::QUIT_EXIT ) { - g->query_exit_to_OS(); + if( g->query_exit_to_OS() ) { + throw game::exit_exception(); + } } } diff --git a/src/main.cpp b/src/main.cpp index fb9dce428c37a..f26cbba523f2f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -853,13 +853,13 @@ int main( int argc, const char *argv[] ) while( true ) { main_menu menu; - try { - if( !menu.opening_screen() ) { - break; - } + if( !menu.opening_screen() ) { + break; + } - shared_ptr_fast ui = g->create_or_get_main_ui_adaptor(); - get_event_bus().send( getVersionString() ); + shared_ptr_fast ui = g->create_or_get_main_ui_adaptor(); + get_event_bus().send( getVersionString() ); + try { while( !do_turn() ) { } } catch( game::exit_exception const &/* ex */ ) { break; diff --git a/src/main_menu.cpp b/src/main_menu.cpp index 7af6fbcf65089..957481a9e03b8 100644 --- a/src/main_menu.cpp +++ b/src/main_menu.cpp @@ -1151,8 +1151,6 @@ bool main_menu::new_character_tab() world_generator->set_active_world( world ); try { g->setup(); - } catch( const game::exit_exception &ex ) { - throw ex; // re-throw to main loop } catch( const std::exception &err ) { debugmsg( "Error: %s", err.what() ); return false; From 616b746b9272481f45ef1432ffb395e504f5d298 Mon Sep 17 00:00:00 2001 From: Zhilkin Serg Date: Fri, 27 Dec 2024 16:32:19 +0300 Subject: [PATCH 4/6] Revert 75999 --- src/do_turn.cpp | 3 --- src/flexbuffer_json.cpp | 4 --- src/game.cpp | 19 --------------- src/game.h | 4 --- src/handle_action.cpp | 7 ------ src/init.cpp | 20 --------------- src/input_context.cpp | 5 ---- src/main.cpp | 54 +++++++++++++++++++++++------------------ src/main_menu.cpp | 9 ------- src/sdltiles.cpp | 5 ++-- src/ui.cpp | 3 +-- 11 files changed, 34 insertions(+), 99 deletions(-) diff --git a/src/do_turn.cpp b/src/do_turn.cpp index 4d9571ffdb7bd..1c77e02109790 100644 --- a/src/do_turn.cpp +++ b/src/do_turn.cpp @@ -103,9 +103,6 @@ namespace turn_handler bool cleanup_at_end() { avatar &u = get_avatar(); - if( g->uquit == QUIT_EXIT ) { - return true; - } if( g->uquit == QUIT_DIED || g->uquit == QUIT_SUICIDE ) { // Put (non-hallucinations) into the overmap so they are not lost. for( monster &critter : g->all_monsters() ) { diff --git a/src/flexbuffer_json.cpp b/src/flexbuffer_json.cpp index 11a3cec8f06fa..28c279d04c7f1 100644 --- a/src/flexbuffer_json.cpp +++ b/src/flexbuffer_json.cpp @@ -7,7 +7,6 @@ #include "cata_unreachable.h" #include "filesystem.h" -#include "game.h" #include "json.h" namespace @@ -253,9 +252,6 @@ bool JsonValue::read( std::string &s, bool throw_on_error ) const void JsonObject::report_unvisited() const { #ifndef CATA_IN_TOOL - if( g && g->uquit == quit_status::QUIT_EXIT ) { - return; - } if( !std::uncaught_exceptions() && report_unvisited_members && !visited_fields_bitset_.all() ) { std::vector skipped_members; skipped_members.reserve( visited_fields_bitset_.size() ); diff --git a/src/game.cpp b/src/game.cpp index 76c28527a9f63..e057b612da69f 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -2866,27 +2866,8 @@ bool game::try_get_right_click_action( action_id &act, const tripoint_bub_ms &mo return true; } -bool game::query_exit_to_OS() -{ - const int old_timeout = inp_mngr.get_timeout(); - inp_mngr.reset_timeout(); - uquit = QUIT_EXIT_PENDING; // change it before query so input_context doesn't get confused - if( query_yn( _( "Really Quit? All unsaved changes will be lost." ) ) ) { - uquit = QUIT_EXIT; - throw exit_exception(); - } - uquit = QUIT_NO; - inp_mngr.set_timeout( old_timeout ); - ui_manager::redraw_invalidated(); - catacurses::doupdate(); - return false; -} - bool game::is_game_over() { - if( uquit == QUIT_EXIT ) { - return query_exit_to_OS(); - } if( uquit == QUIT_DIED || uquit == QUIT_WATCH ) { Creature *player_killer = u.get_killer(); if( player_killer && player_killer->as_character() ) { diff --git a/src/game.h b/src/game.h index 988832e9f68b8..4eeb65a8acc7c 100644 --- a/src/game.h +++ b/src/game.h @@ -57,8 +57,6 @@ enum quit_status { QUIT_NOSAVED, // Quit without saving QUIT_DIED, // Actual death QUIT_WATCH, // Died, and watching aftermath - QUIT_EXIT, // Skip main menu and quit directly to OS - QUIT_EXIT_PENDING, // same as above, used temporarily so input_context doesn't get confused }; enum safe_mode_type { @@ -1010,8 +1008,6 @@ class game void bury_screen() const;// Bury a dead character (record their last words) void death_screen(); // Display our stats, "GAME OVER BOO HOO" public: - bool query_exit_to_OS(); - class exit_exception: public std::exception {}; /** * If there is a robot (that can be disabled), query the player * and try to disable it. diff --git a/src/handle_action.cpp b/src/handle_action.cpp index a1837c2b774a4..e2daf32e8bd7d 100644 --- a/src/handle_action.cpp +++ b/src/handle_action.cpp @@ -336,9 +336,6 @@ input_context game::get_player_input( std::string &action ) creature_tracker &creatures = get_creature_tracker(); do { - if( g->uquit == QUIT_EXIT ) { - break; - } if( bWeatherEffect && get_option( "ANIMATION_RAIN" ) ) { /* Location to add rain drop animation bits! Since it refreshes w_terrain it can be added to the animation section easily @@ -3143,10 +3140,6 @@ bool game::handle_action() // of location clicked. std::optional mouse_target; - if( uquit == QUIT_EXIT ) { - return false; - } - if( uquit == QUIT_WATCH && action == "QUIT" ) { uquit = QUIT_DIED; return false; diff --git a/src/init.cpp b/src/init.cpp index ba0ff56238825..928a741788851 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -44,7 +44,6 @@ #include "field_type.h" #include "filesystem.h" #include "flag.h" -#include "game.h" #include "gates.h" #include "harvest.h" #include "help.h" @@ -104,7 +103,6 @@ #include "translations.h" #include "trap.h" #include "type_id.h" -#include "ui_manager.h" #include "veh_type.h" #include "vehicle_group.h" #include "vitamin.h" @@ -126,20 +124,6 @@ DynamicDataLoader &DynamicDataLoader::get_instance() return theDynamicDataLoader; } -namespace -{ - -void check_sigint() -{ - if( g && g->uquit == quit_status::QUIT_EXIT ) { - if( g->query_exit_to_OS() ) { - throw game::exit_exception(); - } - } -} - -} // namespace - void DynamicDataLoader::load_object( const JsonObject &jo, const std::string &src, const cata_path &base_path, const cata_path &full_path ) @@ -189,7 +173,6 @@ void DynamicDataLoader::load_deferred( deferred_json &data ) } ++it; inp_mngr.pump_events(); - check_sigint(); } data.erase( data.begin(), it ); if( data.size() == n ) { @@ -633,7 +616,6 @@ void DynamicDataLoader::load_all_from_json( const JsonValue &jsin, const std::st // find type and dispatch each object until array close for( JsonObject jo : ja ) { load_object( jo, src, base_path, full_path ); - check_sigint(); } } else { // not an object or an array? @@ -865,7 +847,6 @@ void DynamicDataLoader::finalize_loaded_data() for( const named_entry &e : entries ) { loading_ui::show( _( "Finalizing" ), e.first ); e.second(); - check_sigint(); } if( !get_option( "SKIP_VERIFICATION" ) ) { @@ -971,6 +952,5 @@ void DynamicDataLoader::check_consistency() for( const named_entry &e : entries ) { loading_ui::show( _( "Verifying" ), e.first ); e.second(); - check_sigint(); } } diff --git a/src/input_context.cpp b/src/input_context.cpp index bc3bdc9c8d164..93869ae4532ee 100644 --- a/src/input_context.cpp +++ b/src/input_context.cpp @@ -134,7 +134,6 @@ static const std::string ANY_INPUT = "ANY_INPUT"; static const std::string HELP_KEYBINDINGS = "HELP_KEYBINDINGS"; static const std::string COORDINATE = "COORDINATE"; static const std::string TIMEOUT = "TIMEOUT"; -static const std::string QUIT = "QUIT"; const std::string &input_context::input_to_action( const input_event &inp ) const { @@ -446,10 +445,6 @@ const std::string &input_context::handle_input( const int timeout ) break; } - if( g->uquit == QUIT_EXIT ) { - result = &QUIT; - break; - } const std::string &action = input_to_action( next_action ); //Special global key to toggle language to english and back diff --git a/src/main.cpp b/src/main.cpp index f26cbba523f2f..61627d21558f2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -143,30 +143,42 @@ namespace // Used only if AttachConsole() works FILE *CONOUT; #endif - -#if !defined(_WIN32) -extern "C" void sigint_handler( int /* s */ ) -{ - if( g->uquit != QUIT_EXIT_PENDING ) { - g->uquit = QUIT_EXIT; - } -} -#endif - -void exit_handler( int /* s */ ) +void exit_handler( int s ) { - deinitDebug(); + const int old_timeout = inp_mngr.get_timeout(); + inp_mngr.reset_timeout(); + if( s != 2 || query_yn( _( "Really Quit? All unsaved changes will be lost." ) ) ) { + deinitDebug(); - g.reset(); + int exit_status = 0; + g.reset(); - catacurses::endwin(); + catacurses::endwin(); #if defined(__ANDROID__) - // Avoid capturing SIGABRT on exit on Android in crash report - // Can be removed once the SIGABRT on exit problem is fixed - signal( SIGABRT, SIG_DFL ); + // Avoid capturing SIGABRT on exit on Android in crash report + // Can be removed once the SIGABRT on exit problem is fixed + signal( SIGABRT, SIG_DFL ); #endif +#if !defined(_WIN32) + if( s == 2 ) { + struct sigaction sigIntHandler; + sigIntHandler.sa_handler = SIG_DFL; + sigemptyset( &sigIntHandler.sa_mask ); + sigIntHandler.sa_flags = 0; + sigaction( SIGINT, &sigIntHandler, nullptr ); + kill( getpid(), s ); + } else +#endif + { + imclient.reset(); + exit( exit_status ); + } + } + inp_mngr.set_timeout( old_timeout ); + ui_manager::redraw_invalidated(); + catacurses::doupdate(); } struct arg_handler { @@ -827,7 +839,7 @@ int main( int argc, const char *argv[] ) #if !defined(_WIN32) struct sigaction sigIntHandler; - sigIntHandler.sa_handler = sigint_handler; + sigIntHandler.sa_handler = exit_handler; sigemptyset( &sigIntHandler.sa_mask ); sigIntHandler.sa_flags = 0; sigaction( SIGINT, &sigIntHandler, nullptr ); @@ -859,11 +871,7 @@ int main( int argc, const char *argv[] ) shared_ptr_fast ui = g->create_or_get_main_ui_adaptor(); get_event_bus().send( getVersionString() ); - try { - while( !do_turn() ) { } - } catch( game::exit_exception const &/* ex */ ) { - break; - } + while( !do_turn() ) {} } exit_handler( -999 ); diff --git a/src/main_menu.cpp b/src/main_menu.cpp index 957481a9e03b8..eddbaab741b9c 100644 --- a/src/main_menu.cpp +++ b/src/main_menu.cpp @@ -791,10 +791,6 @@ bool main_menu::opening_screen() #endif while( !start ) { - if( g->uquit == QUIT_EXIT ) { - return false; - } - ui_manager::redraw(); std::string action = ctxt.handle_input(); input_event sInput = ctxt.get_raw_input(); @@ -884,12 +880,9 @@ bool main_menu::opening_screen() // also check special keys if( action == "QUIT" ) { #if !defined(EMSCRIPTEN) - g->uquit = QUIT_EXIT_PENDING; if( query_yn( _( "Really quit?" ) ) ) { - g->uquit = QUIT_EXIT; return false; } - g->uquit = QUIT_NO; #endif } else if( action == "LEFT" || action == "PREV_TAB" || action == "RIGHT" || action == "NEXT_TAB" ) { sel_line = 0; @@ -1203,8 +1196,6 @@ bool main_menu::load_game( std::string const &worldname, save_t const &savegame try { g->setup(); - } catch( game::exit_exception const &/* ex */ ) { - return false; } catch( const std::exception &err ) { debugmsg( "Error: %s", err.what() ); return false; diff --git a/src/sdltiles.cpp b/src/sdltiles.cpp index cc9fa46776b41..a635e03afb553 100644 --- a/src/sdltiles.cpp +++ b/src/sdltiles.cpp @@ -3537,9 +3537,8 @@ static void CheckMessages() try_sdl_update(); } if( quit ) { - if( g->uquit != quit_status::QUIT_EXIT_PENDING ) { - g->uquit = quit_status::QUIT_EXIT; - } + catacurses::endwin(); + exit( 0 ); } } diff --git a/src/ui.cpp b/src/ui.cpp index 99ef13f2dbb37..612342c27b50e 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -994,8 +994,7 @@ void uilist::query( bool loop, int timeout, bool allow_unfiltered_hotkeys ) if( entries[ selected ].enabled || allow_disabled ) { ret = entries[selected].retval; } - } else if( ( allow_cancel && ret_act == "UILIST.QUIT" ) || - ( g->uquit == QUIT_EXIT && ret_act == "QUIT" ) ) { + } else if( allow_cancel && ret_act == "UILIST.QUIT" ) { ret = UILIST_CANCEL; } else if( ret_act == "TIMEOUT" ) { ret = UILIST_WAIT_INPUT; From ace5bc7ab6ecf5fc8f1241a575805c2afce1f5ee Mon Sep 17 00:00:00 2001 From: Zhilkin Serg Date: Fri, 27 Dec 2024 16:32:34 +0300 Subject: [PATCH 5/6] Revert 68071 --- object_creator/creator_main.cpp | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/object_creator/creator_main.cpp b/object_creator/creator_main.cpp index d1f0431b51a3b..72c79eb516819 100644 --- a/object_creator/creator_main.cpp +++ b/object_creator/creator_main.cpp @@ -22,13 +22,6 @@ #include #include -//Required by the sigaction function in the exit_handler -#if defined(_WIN32) -#include "platform_win.h" -#else -#include -#endif - #ifdef _WIN32 #include Q_IMPORT_PLUGIN( QWindowsIntegrationPlugin ); @@ -52,20 +45,7 @@ void exit_handler( int s ) catacurses::endwin(); - // As suggested by https://github.com/CleverRaven/Cataclysm-DDA/pull/67893 - #if !defined(_WIN32) - if( s == 2 ) { - struct sigaction sigIntHandler; - sigIntHandler.sa_handler = SIG_DFL; - sigemptyset( &sigIntHandler.sa_mask ); - sigIntHandler.sa_flags = 0; - sigaction( SIGINT, &sigIntHandler, nullptr ); - kill( getpid(), s ); - } else - #endif - { - exit( exit_status ); - } + exit( exit_status ); } inp_mngr.set_timeout( old_timeout ); } From 049198cf02488027269789b2f9d01ec6e13dbe9e Mon Sep 17 00:00:00 2001 From: Zhilkin Serg Date: Fri, 27 Dec 2024 16:48:07 +0300 Subject: [PATCH 6/6] Revert 67893 --- src/main.cpp | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 61627d21558f2..0812cb4b676ac 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -60,9 +60,6 @@ #include "type_id.h" #include "ui_manager.h" #include "cata_imgui.h" -#if defined(MACOSX) || defined(__CYGWIN__) -# include // getpid() -#endif #if defined(EMSCRIPTEN) #include @@ -161,20 +158,8 @@ void exit_handler( int s ) signal( SIGABRT, SIG_DFL ); #endif -#if !defined(_WIN32) - if( s == 2 ) { - struct sigaction sigIntHandler; - sigIntHandler.sa_handler = SIG_DFL; - sigemptyset( &sigIntHandler.sa_mask ); - sigIntHandler.sa_flags = 0; - sigaction( SIGINT, &sigIntHandler, nullptr ); - kill( getpid(), s ); - } else -#endif - { - imclient.reset(); - exit( exit_status ); - } + imclient.reset(); + exit( exit_status ); } inp_mngr.set_timeout( old_timeout ); ui_manager::redraw_invalidated();