kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #33092
[PATCH] Defer canvas type setting save until destruction of EDA_DRAW_FRAME
Hopefully this fixes:
https://bugs.launchpad.net/kicad/+bug/1741787
although I don't currently have a good way of reproducing the crash.
Chris, if you can give it a try on your crashing machine that would be
greatly appreciated.
Thanks
-Jon
From 764a1cd4f222ef4a7ee08d495d89642950653061 Mon Sep 17 00:00:00 2001
From: Jon Evans <jon@xxxxxxxxxxxxx>
Date: Wed, 10 Jan 2018 23:39:21 -0500
Subject: [PATCH] Defer canvas type setting save until destruction of
EDA_DRAW_FRAME
Fixes: lp:1741787
* https://bugs.launchpad.net/kicad/+bug/1741787
---
common/draw_frame.cpp | 3 +++
gerbview/events_called_functions.cpp | 4 +++-
include/draw_frame.h | 6 ++++++
pcbnew/basepcbframe.cpp | 4 +++-
4 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/common/draw_frame.cpp b/common/draw_frame.cpp
index bd9342155..b8f7c1ae3 100644
--- a/common/draw_frame.cpp
+++ b/common/draw_frame.cpp
@@ -216,6 +216,9 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
EDA_DRAW_FRAME::~EDA_DRAW_FRAME()
{
+ if( m_canvasTypeDirty )
+ saveCanvasTypeSetting( m_canvasType );
+
delete m_actions;
delete m_toolManager;
delete m_toolDispatcher;
diff --git a/gerbview/events_called_functions.cpp b/gerbview/events_called_functions.cpp
index 05d611aac..222ff9953 100644
--- a/gerbview/events_called_functions.cpp
+++ b/gerbview/events_called_functions.cpp
@@ -563,10 +563,12 @@ void GERBVIEW_FRAME::SwitchCanvas( wxCommandEvent& aEvent )
break;
}
- saveCanvasTypeSetting( canvasType );
UseGalCanvas( use_gal );
wxUpdateUIEvent e;
OnUpdateSwitchCanvas( e );
+
+ m_canvasType = canvasType;
+ m_canvasTypeDirty = true;
}
diff --git a/include/draw_frame.h b/include/draw_frame.h
index 899c9784b..6d925eb52 100644
--- a/include/draw_frame.h
+++ b/include/draw_frame.h
@@ -141,6 +141,12 @@ protected:
/// One-shot to avoid a recursive mouse event during hotkey movement
bool m_movingCursorWithKeyboard;
+ /// Flag indicating that drawing canvas type needs to be saved to config
+ bool m_canvasTypeDirty;
+
+ /// The current canvas type
+ EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType;
+
void SetScreen( BASE_SCREEN* aScreen ) { m_currentScreen = aScreen; }
/**
diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp
index 54ba21cb7..62245fc45 100644
--- a/pcbnew/basepcbframe.cpp
+++ b/pcbnew/basepcbframe.cpp
@@ -958,7 +958,9 @@ void PCB_BASE_FRAME::SwitchCanvas( wxCommandEvent& aEvent )
}
UseGalCanvas( use_gal );
- saveCanvasTypeSetting( canvasType );
+
+ m_canvasType = canvasType;
+ m_canvasTypeDirty = true;
}
--
2.14.1
Follow ups