Skip to content

Commit

Permalink
Instead of calling exit(), reset and signal dh
Browse files Browse the repository at this point in the history
  • Loading branch information
snipercup committed Sep 9, 2023
1 parent 73fd431 commit dfba4ea
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion object_creator/creator_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
#include <QtWidgets/qsplashscreen.h>
#include <QtGui/qpainter.h>

//Required by the sigaction function in the exit_handler
#if defined(_WIN32)
#include "platform_win.h"
#else
#include <csignal>
#endif

#ifdef _WIN32
#include <QtCore/QtPlugin>
Q_IMPORT_PLUGIN( QWindowsIntegrationPlugin );
Expand All @@ -46,7 +53,20 @@ void exit_handler( int s )

catacurses::endwin();

exit( exit_status );
// 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 );
}
}
inp_mngr.set_timeout( old_timeout );
}
Expand Down

0 comments on commit dfba4ea

Please sign in to comment.