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
12471247 if (!mpctx->open_active)
12481248 start_open(mpctx, url, mpctx->playing->stream_flags, false);
12491249
1250+ // If thread failed to start, cancel the playback
1251+ if (!mpctx->open_active)
1252+ goto cancel;
1253+
12501254 // User abort should cancel the opener now.
12511255 mp_cancel_set_parent(mpctx->open_cancel, mpctx->playback_abort);
12521256
@@ -1265,6 +1269,7 @@ static void open_demux_reentrant(struct MPContext *mpctx) · 12 unmodified lines
12651269 mpctx->error_playing = mpctx->open_res_error;
12661270 }
12671271
1272+cancel:
12681273 cancel_open(mpctx); // cleanup
12691274 }
12701275

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