Fix Menu.append act different from SimpleMenuModel cause crash#7426
Open
Fix Menu.append act different from SimpleMenuModel cause crash#7426
Conversation
Author
|
During the test, I found a bug will cause unused MenuItem not collected by the gc. I put its fix also in this pr for convenient :D . Here is the reproducing code function tryLeak() {
console.log('Processing...')
var i = 10000
while (i > 0) {
const item = new nw.MenuItem({ label: 'My-b10e17ab-44c9-MenuItem' })
menu.append(item)
menu.remove(item)
i--
}
console.log('Done!')
}The heap snapshot |
Author
|
@rogerwang can you have a look at the PR? If there's something more required, let me know. |
Member
|
Thanks. Will see it soon. |
|
I also have this problem at v0.50.1. I have a nagging feeling this is causing some problem on WIndows for my app, whereas MacOS works fine (but Heap MenuItems are not gc:ed here either) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


NWJS Version : nwjs-v0.45.0-beta1-linux-x64.tar.gz
Operating System : Ubuntu 19.10
Expected behavior
Popup menu become empty
Actual behavior
Program crashed
How to reproduce
Use the script below, then right click the body, select
Trigger Remove All MenuItemThe output