You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.
Attempt to dispose all menu items with unexpected result.
favoritesMenu.dispose()
Expected behavior: [What you expect to happen]
All items are removed from the menu if dispose() is executed.
Actual behavior: [What actually happens]
Scenario1 occurs as expected. Scenario2 does not work as expected.
Scenario2: Items item1 and item2 is removed as expected. however Extra -> Test -> separator remains. Restarting Atom brings back normality.
Reproduces how often: [What percentage of the time does it reproduce?]
100%
When "unmerging" menu items that contain separators, those separators cannot be uniquely identified so they are just left hanging around in the menu after the other textual items have been removed. When the only items left are just separators, the parent menu does not get fully destroyed.
It appears that we need to refactor the menu management code a bit so that a uniqueness key can be added to separator items so that they can be identified when a group of menu items is being removed.
Prerequisites
Description
Tags: API, menu, atom.menu.add(), dispose()
If a menu object is disposed, this object is not disposed properly when one of the object's items is a 'separator`.
Building the object would be with the instruction
favoritesMenu = atom.menu.add( .. )
Disposing of the object would be..
favoritesMenu.dispose()
Steps to Reproduce
favoritesMenu = atom.menu.add( .. )
favoritesMenu.dispose()
Scenario1 - Does work
Execute code in the development console...
Notice the
- - - -
item.Scenario2 - Does not work
Execute code in the development console...
Notice the
separator
item.Expected behavior: [What you expect to happen]
All items are removed from the menu if
dispose()
is executed.Actual behavior: [What actually happens]
Scenario1 occurs as expected. Scenario2 does not work as expected.
Scenario2: Items
item1
anditem2
is removed as expected. howeverExtra -> Test -> separator
remains. Restarting Atom brings back normality.Reproduces how often: [What percentage of the time does it reproduce?]
100%
Versions
Additional Information
Originally reported by @gliviu on https://discuss.atom.io/t/menu-refresh-fails-for-separators/51255. @gliviu constructed similar coding in
init.js
which led him to discover the behaviour.Thanks for your attention.
- Dan Padric
The text was updated successfully, but these errors were encountered: