-
Notifications
You must be signed in to change notification settings - Fork 411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Context menu crash #589
Comments
Was able to recreate this while running from PyCharm. I added some debug output at the start (to show when we drop into contextMenu.py) and one under the "if m.display(srcContext, selection):" loop (to show which menus we open). I've included a couple examples at the top where it works correctly, and then you'll see where it starts throwing tracebacks (and I start clicking around on various menus).
|
I think I might have found the problem.
When this occurs, the item ID is always higher than 32767.
So for someone who doesn't use right click much, this isn't an issue. Since I'm a true EVE player and right click all the things, and a new ID is generated each time I right click (actually, looks like multiple IDs are generated each time you right click), explains why I run into this issue a lot. The solution seems to be to have a pool of IDs and cycle through them.
Here's the bug report: |
Here's a little more information: http://comments.gmane.org/gmane.comp.lib.wxwindows.general/84338 He suggests two (feasible) workarounds:
I'll continue to look into this on my free time, but it's not a high priority as the problem goes away after restarting pyfa. |
In one of the two versions before the one we're on (2.8 or 2.9), they worked a bunch on this so that it would reuse the IDs and clean them up. At least that's my understanding. So I'm guessing that we're not destroying the menus properly. Because of the submenu's we generate, we're generating a LOT of ID's each time we click. As an example:
So that's 213 ID's generated for that particular menu, per click. So if you open up the context menu 100-150 times, you're done. That might be plenty for someone who uses the other shortcuts, but if you do everything through the context menu, you'll hit that pretty quick. I'm guessing that this became noticeable when the skills were added, since that seems to be generating the bulk of the ID's. Can we assign static ID's to any of these menu items, so we aren't recreating them every single time (seems to be one of the more popular options)? Can we generate the menu with less ID's? |
I played around with this a little last night and today. Very small change, but it works pretty fucking well (I am very surprised it was this straightforward) https://github.com/blitzmann/Pyfa/tree/context-menu-ids Basically I set up a class variable in ContextMenu that stores a list of IDs that have already been generated for the context menu in the past. Every time the context menu is spawned, the index resets to 0 so that we are always reusing the stuff in the list, and then increments that index for every ID request. If the list is too small, automatically append the list with a new ID to have it dynamically grow as needed. I plan to pre-load it with ~200-300 IDs when it's initialized just so we have a good starting point. Bust current testing has proved promising. |
See f9c5954 |
Some folks reporting context menu not showing up after a while. Pyfa doesn't crash, menu just stops working.
The text was updated successfully, but these errors were encountered: