From: torres <> Date: Thu, 11 Oct 2012 14:35:49 +0000 (+0000) Subject: Bug #1682 Crash deleting the actual connection creation X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=bbtkGEditor.git;a=commitdiff_plain;h=e4d5a319ef249bde6c4f4ddfee66f6258558bf91 Bug #1682 Crash deleting the actual connection creation --- diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx index 2ca30ba..20caad2 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx @@ -52,6 +52,8 @@ namespace bbtk { _isConnected = false ; _value = "" ; _isValueSet = false ; + + } //========================================================================= diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx index bc9e4b5..3a411d8 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx @@ -507,7 +507,11 @@ GPortController* wxVtkSceneManager::createGPort(int portType, //========================================================================= -int wxVtkSceneManager::createGConnector(GPortModel* startPort) { +int wxVtkSceneManager::createGConnector(GPortModel* startPort) +{ + + + int type = GCONNECTOR; manualConnectorContourController *manContourControl = new manualConnectorContourController(); @@ -530,6 +534,8 @@ int wxVtkSceneManager::createGConnector(GPortModel* startPort) { manContourView->SetColorEditContour(0.5, 0.5, 0.5); manContourView->SetColorSelectContour(1, 0.8, 0); + + /** * JGRR AND CM * Width increased from 2 to 3, it simplifies line handling and spline control :P @@ -677,6 +683,7 @@ void wxVtkSceneManager::update(int idController, int command) { // The last one is the controller of the connector std::map::iterator it2; + for (it2 = _controllers.begin(); it2 != _controllers.end(); ++it2) { GObjectController *cont = it2->second; if (cont->getGObjectType() == GPORT) { @@ -953,8 +960,10 @@ void wxVtkSceneManager::CancelConnection() //========================================================================= -bool wxVtkSceneManager::OnRightButtonUp() { - if (_worldState == INIT_CREATION_CONTOUR) { +bool wxVtkSceneManager::OnRightButtonUp() +{ + if (_worldState == INIT_CREATION_CONTOUR) + { CancelConnection(); } UnSelectBlackBoxes(); @@ -1079,8 +1088,21 @@ bool wxVtkSceneManager::OnChar() // KeyCode 127 : Delete Key // KeyCode 8 : Backspace Key + + + if (keyCode == 8 || keyCode == 127 || keyCode == 27) + { + if (_worldState == INIT_CREATION_CONTOUR) + { + CancelConnection(); + UnSelectBlackBoxes(); + } + } + + if (keyCode == 8 || keyCode == 127) { + for (int i = 0; i < (int) _selectedObjects.size(); i++) { int id = _selectedObjects[i];