History

player: run all update handlers on init

The refactoring in bbac628a1b01261766459c6556e36d2443a42534 missed that the initial update handler didn't immediately run all the triggered callbacks but would instead delay it until the next playloop. This subtly breaks things of course like hooks, force window handling, etc. Ensure that we immediately run all the callbacks like before on startup. Fixes bbac628a1b01261766459c6556e36d2443a42534 Fixes https://github.com/mpv-player/mpv/pull/15828#issuecomment-2663830477

Dudemanguy committed 1 year ago

Commit e2f21991 parent 1b9ac223 files · +3 −1Browse files

Unified · Split

3 files
  1. player/core.h +1 −0
  2. player/main.c +1 −0
  3. player/playloop.c +1 −1
player/core.h+1−0
@@ -600,6 +600,7 @@ void mp_wakeup_core(struct MPContext *mpctx); · 599 unmodified lines
600600 void mp_wakeup_core_cb(void *ctx);
601601 void mp_core_lock(struct MPContext *mpctx);
602602 void mp_core_unlock(struct MPContext *mpctx);
603+void handle_option_callbacks(struct MPContext *mpctx);
603604 double get_relative_time(struct MPContext *mpctx);
604605 void reset_playback_state(struct MPContext *mpctx);
605606 void set_pause_state(struct MPContext *mpctx, bool user_pause);
player/main.c+1−0
@@ -383,6 +383,7 @@ int mp_initialize(struct MPContext *mpctx, char **options) · 382 unmodified lines
383383 m_config_set_update_dispatch_queue(mpctx->mconfig, mpctx->dispatch);
384384 // Run all update handlers.
385385 mp_option_change_callback(mpctx, NULL, UPDATE_OPTS_MASK, false);
386+ handle_option_callbacks(mpctx);
386387
387388 if (handle_help_options(mpctx))
388389 return 1; // help
player/playloop.c+1−1
@@ -122,7 +122,7 @@ static void mp_process_input(struct MPContext *mpctx) · 121 unmodified lines
122122 }
123123
124124 // Process any queued option callbacks.
125−static void handle_option_callbacks(struct MPContext *mpctx)
125+void handle_option_callbacks(struct MPContext *mpctx)
126126 {
127127 for (int i = 0; i < mpctx->num_option_callbacks; i++)
128128 mp_option_run_callback(mpctx, i);

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