← Back to team overview

kicad-developers team mailing list archive

[PATCH] Fix segfault on quit

 

Under certain (but not all) conditions, kicad applications segfault on 
quit. This has been reported:

https://bugs.launchpad.net/kicad/+bug/1431028
https://bugs.launchpad.net/kicad/+bug/1467221

It appears to be the case that Pgm().OnPgmExit() was called in the wrong 
place. This patch moves it from APP_SINGLE_TOP::OnRun() to 
APP_SINGLE_TOP::OnExit(), which appears to correct the issue.

--
Chris

commit 1fd47fa8a2bdb3daef67029ed076005e049737b7
Author: Chris Pavlina <cpavlin1@xxxxxxxxxxxxxx>
Date:   Mon Jun 22 19:01:12 2015 -0400

    Move OnPgmExit to the correct place to avoid segfault

diff --git a/common/single_top.cpp b/common/single_top.cpp
index 8addf58..c1d8f17 100644
--- a/common/single_top.cpp
+++ b/common/single_top.cpp
@@ -143,6 +143,8 @@ struct APP_SINGLE_TOP : public wxApp
 
     int  OnExit()           // overload wxApp virtual
     {
+        Pgm().OnPgmExit();
+
         return wxApp::OnExit();
     }
 
@@ -169,8 +171,6 @@ struct APP_SINGLE_TOP : public wxApp
             wxLogError( wxT( "Unhandled exception of unknown type" ) );
         }
 
-        Pgm().OnPgmExit();
-
         return ret;
     }
 

Follow ups