[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    Re: RFR: 8296409: Multiple copies of accelerator change listeners are added to MenuItems, but only 1
From:       Kevin Rushforth <kcr () openjdk ! org>
Date:       2022-11-30 19:56:12
Message-ID: bCzSG4pQkhypZxQtuek2_N4ornTrEoHNOEaNf0cJSnA=.c63b65b2-ef1a-412b-b48d-e5b1fe456d65 () github ! com
[Download RAW message or body]

On Mon, 7 Nov 2022 12:03:38 GMT, Dean Wookey <dwookey@openjdk.org> wrote:

> > When menu buttons are added and removed from the scene, an accelerator change \
> > listener is added to each menu item in the menu. There is nothing stopping the \
> > same change listener being added multiple times. 
> > MenuButtonSkinBase calls the \
> > ControlAcceleratorSupport.addAcceleratorsIntoScene(getSkinnable().getItems(), \
> > getSkinnable()); method each time the button is added to the scene, but that \
> > method itself also registers a listener to call itself. Each time the button is \
> > added to the scene, the method is called at least twice. 
> > When it's removed from the scene, the remove accelerator method is also called \
> > twice, but only the first call removes a change listener attached to the \
> > accelerator because the first call removes the entry from the hashmap \
> > changeListenerMap. The second call finds nothing in the map, and doesn't remove \
> > the additional instance. 
> > This pull request just removes the redundant code in the MenuButtonSkinBase.
> 
> Dean Wookey has updated the pull request incrementally with one additional commit \
> since the last revision: 
> Added changing scene tests for accelerator change listeners

Probably better to just wait then.

-------------

PR: https://git.openjdk.org/jfx/pull/937


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic