From ee1f19d904b69a7fdd8f3a8b6562598aa0a537d0 Mon Sep 17 00:00:00 2001 From: Adeel Asghar Date: Wed, 9 Dec 2020 12:11:30 +0100 Subject: [PATCH] Remove the current connection when user cancels the operation (#7036) --- OMEdit/OMEditLIB/Modeling/ModelWidgetContainer.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/OMEdit/OMEditLIB/Modeling/ModelWidgetContainer.cpp b/OMEdit/OMEditLIB/Modeling/ModelWidgetContainer.cpp index fefd1229053..b6a819737f5 100644 --- a/OMEdit/OMEditLIB/Modeling/ModelWidgetContainer.cpp +++ b/OMEdit/OMEditLIB/Modeling/ModelWidgetContainer.cpp @@ -2225,6 +2225,8 @@ void GraphicsView::addConnection(Element *pComponent) } } } + // Once we are done creating the connection then we should set mpConnectionLineAnnotation to 0. + mpConnectionLineAnnotation = 0; } } @@ -2234,11 +2236,11 @@ void GraphicsView::addConnection(Element *pComponent) */ void GraphicsView::removeCurrentConnection() { - if (isCreatingConnection()) { - setIsCreatingConnection(false); - deleteConnectionFromList(mpConnectionLineAnnotation); - removeItem(mpConnectionLineAnnotation); - delete mpConnectionLineAnnotation; + setIsCreatingConnection(false); + deleteConnectionFromList(mpConnectionLineAnnotation); + removeItem(mpConnectionLineAnnotation); + if (mpConnectionLineAnnotation) { + mpConnectionLineAnnotation->deleteLater(); mpConnectionLineAnnotation = 0; } }