From: corredor <> Date: Thu, 24 May 2012 13:45:12 +0000 (+0000) Subject: Bug #1355 The complete tab is not erased from memory. Only the objects are deleted... X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=25cc7b0782c5950c95cbf3fa94586769ae093f10;p=bbtkGEditor.git Bug #1355 The complete tab is not erased from memory. Only the objects are deleted and the tab is hidden. Execution problems when a tab is deleted using delete or DeletePage --- diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx index ab5c55f..682c119 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx @@ -62,7 +62,7 @@ printf("EED wxGEditorTabPanel::wxGEditorTabPanel 1\n"); //========================================================================= wxGEditorTabPanel::~wxGEditorTabPanel() { -printf ("EED %p ~wxGEditorTabPanel()\n" , this ); +printf ("EED %p ~wxGEditorTabPanel() START \n" , this ); //ED02JUIN2010 _sceneManager->disconnectDrop(); _panelsManager->VerifyLastTabPanel(); @@ -70,6 +70,8 @@ printf ("EED %p ~wxGEditorTabPanel()\n" , this ); delete _panelAUIMgr; delete _sceneManager; + printf ("EED %p ~wxGEditorTabPanel() END\n" , this ); + } //========================================================================= diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx index 32173e9..14f8531 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx @@ -48,6 +48,8 @@ namespace bbtk _notebook = _parent->getAuiNotebook(); addNewTab(); _notebook->Connect(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED,wxAuiNotebookEventHandler(wxTabPanelsManager::OnTabChanged),0,this); + _notebook->Connect(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE,wxAuiNotebookEventHandler(wxTabPanelsManager::OnTabClose),0,this); + } //========================================================================= @@ -65,10 +67,16 @@ printf("EED wxTabPanelsManager::addNewTab 0\n"); newPanel->setPanelsManager(this); _panels[_lastId] = newPanel; _actual = newPanel; + _notebook->AddPage(newPanel, tabName ,true); + printf("EED wxTabPanelsManager::addNewTab 1\n"); } + + + + //========================================================================= wxAuiNotebook* wxTabPanelsManager::getAuiNotebook() { @@ -234,6 +242,37 @@ printf("wxTabPanelsManager::VerifyActualTabPanel %d \n", this->_notebook->GetPa } //========================================================================= + + void wxTabPanelsManager::OnTabClose(wxAuiNotebookEvent& event) + { + + std::cout<<"RaC wxTabPanelsManager::OnTabClose Start... "<<_panels.size()<0) + { + wxGEditorTabPanel* tab = (wxGEditorTabPanel*)_notebook->GetPage(index); + int id = tab->getPanelId(); + tab->deleteAllBoxes(); + _panels.erase(id); + + _notebook->RemovePage(index); + + std::cout<<"RaC wxTabPanelsManager::OnTabClose IMPORTANT. The complete tab is not erased from memory... "<