Make sure projects are cleaned up nicely when frames close

PROJECT objects will be deleted by SETTINGS_MANAGER::UnloadProject
so we need to make sure that this is called at an early enough point
in the closing process that anything needed by the PROJECT dtor
is still around.

Also fix an issue where the schematic worksheet was depending on
the project existing after the schematic had been reset.
This commit is contained in:
Jon Evans
2020-08-08 16:52:57 -04:00
parent 79e40cf765
commit 32a7d00256
6 changed files with 26 additions and 0 deletions
+5
View File
@@ -22,6 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <kiface_i.h>
#include <pcb_base_edit_frame.h>
#include <tool/tool_manager.h>
#include <pcb_layer_widget.h>
@@ -59,6 +60,10 @@ PCB_BASE_EDIT_FRAME::~PCB_BASE_EDIT_FRAME()
GFootprintList.WriteCacheToFile( &footprintInfoCache );
}
// Close the project if we are standalone, so it gets cleaned up properly
if( Kiface().IsSingle() )
GetSettingsManager()->UnloadProject( &Prj() );
GetCanvas()->GetView()->Clear();
}