History

player/loadfile: cancel playback cleanly if thread fails to start

Currently it would crash, due to already canceled and freed resources.

Kacper Michajłow committed 2 years ago

Commit aea5b3d1 parent 66fdec81 file · +5 −0Browse files

Unified · Split

player/loadfile.c+5−0
@@ -1247,6 +1247,10 @@ static void open_demux_reentrant(struct MPContext *mpctx) · 1246 unmodified lines
1247 if (!mpctx->open_active)1247 if (!mpctx->open_active)
1248 start_open(mpctx, url, mpctx->playing->stream_flags, false);1248 start_open(mpctx, url, mpctx->playing->stream_flags, false);
1249 1249
1250 // If thread failed to start, cancel the playback
1251 if (!mpctx->open_active)
1252 goto cancel;
1253
1250 // User abort should cancel the opener now.1254 // User abort should cancel the opener now.
1251 mp_cancel_set_parent(mpctx->open_cancel, mpctx->playback_abort);1255 mp_cancel_set_parent(mpctx->open_cancel, mpctx->playback_abort);
1252 1256
@@ -1265,6 +1269,7 @@ static void open_demux_reentrant(struct MPContext *mpctx) · 12 unmodified lines
1265 mpctx->error_playing = mpctx->open_res_error;1269 mpctx->error_playing = mpctx->open_res_error;
1266 }1270 }
1267 1271
1272cancel:
1268 cancel_open(mpctx); // cleanup1273 cancel_open(mpctx); // cleanup
1269}1274}
1270 1275

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