Skip to content
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

win32: fix the issue of menu click failure caused by excessive menu-data updates #15701

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

verygoodlee
Copy link
Contributor

@verygoodlee verygoodlee commented Jan 17, 2025

basically a copy of tsl0922/mpv-menu-plugin#77

if you have 200+ menu items and update menu-data about 400 times, clicking menu item will not execute any command, the reason is that the menu identifier greater than the max value of 16-bit unsigned integer.

  1. make menu id always less than 0xF000 as 861908c7 said
  2. old menu items are never reused, should delete by DeleteMenu() instead of RemoveMenu(), destroys the handle and frees the memory

Copy link

github-actions bot commented Jan 17, 2025

Download the artifacts for this pull request:

Windows
macOS

basically a copy of tsl0922/mpv-menu-plugin#77

if you have 200+ menu items and update `menu-data` about 400 times,
clicking menu item will not execute any command, the reason is that the
menu identifier greater than the max value of 16-bit unsigned integer.

1. make menu id always less than 0xF000 as mpv-player/mpv@861908c7 said
2. old menu items are never reused, should delete by DeleteMenu()
   instead of RemoveMenu(), destroys the handle and frees the memory
@verygoodlee
Copy link
Contributor Author

verygoodlee commented Jan 20, 2025

this is a simple test config portable_config.zip, contains dyn_menu.lua input.conf and a test.lua run cycle mute 350 times to trigger menu-data updates.

  • run mpv.exe and wait for test.lua to complete execution
  • open context menu try to click Exit

according to my test in shinchiro's build, click Exit didn't execute any command.
if modify test.lua to run cycle mute 1000 times, I can't even open context menu, the reason should be that the handle to the old menu items was not destroyed.

test passed in github actions build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant