BMediaFile: fix destruction order.
The fSource can point to a source with code inside a media plug-in (in particular, the HTTP source from the http_streamer plugin). However, deleting the extractor can cause the plugin to become "unreferenced" and unloaded. If we try to call code to delete the source later, we find that the code is already unloaded, and the app crashes. This happens in Web+ when navigating away from Youtube or otherwise interrupting a video while it is being played. Fixes the crashing part of #13058.
This commit is contained in:
@@ -469,15 +469,18 @@ BMediaFile::_UnInit()
|
||||
free(fTrackList);
|
||||
fTrackList = NULL;
|
||||
fTrackNum = 0;
|
||||
delete fExtractor;
|
||||
fExtractor = NULL;
|
||||
delete fWriter;
|
||||
fWriter = NULL;
|
||||
if (fDeleteSource) {
|
||||
delete fSource;
|
||||
fSource = NULL;
|
||||
fDeleteSource = false;
|
||||
}
|
||||
// Deleting the extractor or writer can cause unloading of the plugins.
|
||||
// The source must be deleted before that, because it can come from a
|
||||
// plugin (for example the http_streamer)
|
||||
delete fExtractor;
|
||||
fExtractor = NULL;
|
||||
delete fWriter;
|
||||
fWriter = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user