From f6dc4252e737121d0f4a55cca4014a3050145fb8 Mon Sep 17 00:00:00 2001 From: Patrick Ziegler Date: Sat, 25 May 2024 22:36:50 +0200 Subject: [PATCH] Set source/target container figure to null after Zest connection removal The local variables should be cleared when the figure is removed, even if either of the containers has already been disposed. Amends 2288625a8c910773a4e3076691b39ad3c13a2cc8 --- .../eclipse/zest/core/widgets/GraphConnection.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/GraphConnection.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/GraphConnection.java index bab8aed30..6f95b9ee0 100644 --- a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/GraphConnection.java +++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/GraphConnection.java @@ -163,12 +163,18 @@ void removeFigure() { } } connectionFigure = null; - if (sourceContainerConnectionFigure != null && sourceContainerConnectionFigure.getParent() != null) { - sourceContainerConnectionFigure.getParent().remove(sourceContainerConnectionFigure); + if (sourceContainerConnectionFigure != null) { + IFigure sourceContainerConnectionParent = sourceContainerConnectionFigure.getParent(); + if (sourceContainerConnectionParent != null) { + sourceContainerConnectionParent.remove(sourceContainerConnectionFigure); + } sourceContainerConnectionFigure = null; } if (targetContainerConnectionFigure != null && targetContainerConnectionFigure.getParent() != null) { - targetContainerConnectionFigure.getParent().remove(targetContainerConnectionFigure); + IFigure targetContainerConnectionParent = targetContainerConnectionFigure.getParent(); + if (targetContainerConnectionParent != null) { + targetContainerConnectionParent.remove(targetContainerConnectionFigure); + } targetContainerConnectionFigure = null; }