changeset 5485:5980afe89a4c

RT-33713 : MenuBar sample seems to be leaking through F10 accelerator, reviewed by David
author mickf
date Tue, 22 Oct 2013 17:17:13 +0100
parents db9a779eeb38
children 87a605e50354
files modules/controls/src/main/java/com/sun/javafx/scene/control/skin/MenuBarSkin.java
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/MenuBarSkin.java	Tue Oct 22 10:27:14 2013 -0400
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/MenuBarSkin.java	Tue Oct 22 17:17:13 2013 +0100
@@ -381,6 +381,17 @@
                     if (t != null)
                         t.removeEventFilter(MouseEvent.MOUSE_CLICKED, weakSceneMouseEventHandler);
                 }
+                
+                /**
+                 * remove the f10 accelerator from the old scene
+                 * add it to the new scene
+                 */
+                if (t != null) {
+                    t.getAccelerators().remove(acceleratorKeyCombo);
+                }
+                if (t1 != null ) {
+                    t1.getAccelerators().put(acceleratorKeyCombo, firstMenuRunnable);
+                }
             }
         });
     }