From 1ee652d48c5e9a5fb5ea4e550492935689ce53f9 Mon Sep 17 00:00:00 2001 From: Teemu Suo-Anttila Date: Tue, 27 Oct 2015 17:19:46 +0200 Subject: Fix VAbstractOrderedLayout widget removal race condition (#18703) Removing a widget that got moved to another layout occasionally caused slot to lose track of related widget. As a result the layout never created a new slot when the same widget is put back in there. Change-Id: I0d8793324b8a5ac8a06aa2803ac8de22b90b7545 --- .../com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/src/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java b/client/src/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java index 34362c9c2b..1a36ba9c93 100644 --- a/client/src/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java +++ b/client/src/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java @@ -209,8 +209,10 @@ public class VAbstractOrderedLayout extends FlowPanel { * @return */ public void removeWidget(Widget widget) { - Slot slot = widgetToSlot.get(widget); - removeSlot(slot); + Slot slot = widgetToSlot.remove(widget); + if (slot != null) { + removeSlot(slot); + } } /** @@ -226,7 +228,6 @@ public class VAbstractOrderedLayout extends FlowPanel { */ protected void removeSlot(Slot slot) { remove(slot); - widgetToSlot.remove(slot.getWidget()); } /** -- cgit v1.2.3