From ec7f2388af2df27bf0f7e1801b39729f9755baed Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Wed, 15 Apr 2020 08:00:27 +0200 Subject: player: don't segfault when unloading tracks e1e714ccc introduced a regression here when unloading a track (e.g. on VO/AO initilization error), due to no corresponding option existing for video/audio tracks with orders above 0, but the loop in `mp_deselect_track` being hard-coded to clear tracks up to NUM_PTRACKS. Introduce the simplest possible hackaround. --- player/loadfile.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/player/loadfile.c b/player/loadfile.c index d09addeb89..5972c634be 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -591,6 +591,8 @@ static void mark_track_selection(struct MPContext *mpctx, int order, { assert(order >= 0 && order < NUM_PTRACKS); mpctx->opts->stream_id[order][type] = value; + if (type != STREAM_SUB && order != 0) + return; // mconfig only contains one track for vid/aid m_config_notify_change_opt_ptr(mpctx->mconfig, &mpctx->opts->stream_id[order][type]); } -- cgit v1.2.3