History

js: events registration: clarify breakage/fix

This commit is mainly for correcting the previous commit message. The previous commit fixed an issue where [un]registering events above the first event ID "hole" is not requested from libmpv, and that's indeed true. However, this had nearly zero impact in practice, because libmpv enables all events by default anyway (except TICK). Therefore, above the first ID "hole" [un]register requests are not sent to libmpv, and the events just keep arriving. But the callback functions are still added/removed correctly (at defaults.js), and so the script is not called back even if unregister did not actually happen with libmpv. The only event which was affected is TICK - which is not enabled by default as it's deprecated, and before the previous commit could not be enabled. So the fix is more a general correctness fix now that the IDs array can have "holes", but with effctively no impact in practice.

Avi Halachmi (:avih) committed 4 years ago

Commit 2157bb11 parent 5c5e35c1 file · +1 −0Browse files

Showing the changes to player/javascript.c (1 of 1 file). Show all

Unified · Split

player/javascript.c+1−0
@@ -611,6 +611,7 @@ static void script__request_event(js_State *J) · 610 unmodified lines
611611 bool enable = js_toboolean(J, 2);
612612
613613 for (int n = 0; n < 256; n++) {
614+ // some n's may be missing ("holes"), returning NULL
614615 const char *name = mpv_event_name(n);
615616 if (name && strcmp(name, event) == 0) {
616617 push_status(J, mpv_request_event(jclient(J), n, enable));

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t