From 7ff3dd080798619140d7481ab0f39d5669b4a46e Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Tue, 14 Jun 2016 12:08:35 +0200 Subject: [PATCH] Make sure GL canvas is visible upon destruction in Module properties dialogs. --- pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp | 8 ++++++-- pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp index 442a036d32..012be0861c 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp @@ -96,8 +96,6 @@ DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR( PCB_EDIT_FRAME* aParent DIALOG_MODULE_BOARD_EDITOR::~DIALOG_MODULE_BOARD_EDITOR() { - m_page = m_NoteBook->GetSelection(); - for( unsigned ii = 0; ii < m_Shapes3D_list.size(); ii++ ) delete m_Shapes3D_list[ii]; @@ -107,6 +105,12 @@ DIALOG_MODULE_BOARD_EDITOR::~DIALOG_MODULE_BOARD_EDITOR() // browsed but not used would consume memory Prj().Get3DCacheManager()->FlushCache( false ); + // the GL canvas has to be visible before it is destroyed + m_page = m_NoteBook->GetSelection(); + m_NoteBook->SetSelection( 1 ); + delete m_PreviewPane; + m_PreviewPane = NULL; // just in case, to avoid double-free + delete m_ReferenceCopy; delete m_ValueCopy; } diff --git a/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp b/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp index 847adb66cc..7c6b206264 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp @@ -89,8 +89,6 @@ DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR( FOOTPRINT_EDIT_FRAME* DIALOG_MODULE_MODULE_EDITOR::~DIALOG_MODULE_MODULE_EDITOR() { - m_page = m_NoteBook->GetSelection(); - for( unsigned ii = 0; ii < m_shapes3D_list.size(); ii++ ) delete m_shapes3D_list[ii]; @@ -100,6 +98,12 @@ DIALOG_MODULE_MODULE_EDITOR::~DIALOG_MODULE_MODULE_EDITOR() // browsed but not used would consume memory Prj().Get3DCacheManager()->FlushCache( false ); + // the GL canvas has to be visible before it is destroyed + m_page = m_NoteBook->GetSelection(); + m_NoteBook->SetSelection( 1 ); + delete m_PreviewPane; + m_PreviewPane = NULL; // just in case, to avoid double-free + delete m_referenceCopy; delete m_valueCopy; }