summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorAvi Halachmi (:avih) <avihpit@yahoo.com>2021-12-26 20:20:46 +0200
committerAvi Halachmi (:avih) <avihpit@yahoo.com>2021-12-26 21:00:21 +0200
commit2157bb1995334e25bd865b438e23764ff966cacb (patch)
tree75cefd52556ebd58648b3ed101ed322b71ed39f3 /player
parent5c5e35c1bcf9ccfa471dc590caf0c25ee158ca03 (diff)
downloadmpv-2157bb1995334e25bd865b438e23764ff966cacb.tar.bz2
mpv-2157bb1995334e25bd865b438e23764ff966cacb.tar.xz
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.
Diffstat (limited to 'player')
-rw-r--r--player/javascript.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/player/javascript.c b/player/javascript.c
index d4191c582b..7f2dc0970b 100644
--- a/player/javascript.c
+++ b/player/javascript.c
@@ -611,6 +611,7 @@ static void script__request_event(js_State *J)
bool enable = js_toboolean(J, 2);
for (int n = 0; n < 256; n++) {
+ // some n's may be missing ("holes"), returning NULL
const char *name = mpv_event_name(n);
if (name && strcmp(name, event) == 0) {
push_status(J, mpv_request_event(jclient(J), n, enable));