From d00deb0f545bf3f6ee1a0b69899569b8da13567e Mon Sep 17 00:00:00 2001 From: apolds Date: Wed, 24 May 2017 07:34:28 +0200 Subject: [PATCH] Allow changing NavigationStateManager (#9416) Unregister old NavigationStateManager before setting new one (backport of #9410). Fixes #9406 --- server/src/main/java/com/vaadin/navigator/Navigator.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/src/main/java/com/vaadin/navigator/Navigator.java b/server/src/main/java/com/vaadin/navigator/Navigator.java index 15936f6168..172ab39928 100644 --- a/server/src/main/java/com/vaadin/navigator/Navigator.java +++ b/server/src/main/java/com/vaadin/navigator/Navigator.java @@ -513,6 +513,10 @@ public class Navigator implements Serializable { if (stateManager == null) { stateManager = new UriFragmentManager(ui.getPage()); } + if (stateManager != null && this.stateManager != null + && stateManager != this.stateManager) { + this.stateManager.setNavigator(null); + } this.stateManager = stateManager; this.stateManager.setNavigator(this); this.display = display; -- 2.39.5