Commit 2275b41d authored by Aleksy Barcz's avatar Aleksy Barcz
Browse files

Removed signal handlers from draw3

+ caused deadlocks on program exit, as functions called from signal handler were not async-signal-safe (see: man signal-safety). Amongst others, malloc and pthread_join are not safe.
+ OS will cleanup our threads and db queue anyway
+ saving defined user params on exit is no longer necessary as we save them on every edit action
+ because of all the above, we can safely leave signal handling and cleanup to standard OS behavior on Linux
parent fa07d5a9
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -151,12 +151,6 @@ extern void InitXmlResource();
bool read_only;
std::unique_ptr<FileLocker> m_instance;

void handler(int sig)
{
	wxGetApp().OnExit();
	_exit(0);
}

namespace {
int GL_ATTRIBUTES[] = {
	WX_GL_RGBA,
@@ -241,9 +235,6 @@ bool DrawApp::OnInit() {


	SetProgName(_T("Draw 3"));
	signal(SIGHUP, handler);
	signal(SIGINT, handler);
	signal(SIGTERM, handler);

	if (m_just_print_version) {
		std::cout << SZARP_VERSION << std::endl;
+1 −1
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ class DrawApp : public DrawGLApp
{
public:
	/** 
	 * Method called on application end and on sigint.
	 * Method called on application end.
	 */
	int OnExit();