Don't require that subtitles passed to SubtitlesProvider::LoadSubtitles be a copy that can be deleted
Originally committed to SVN as r4477.
This commit is contained in:
parent
72cbf4939f
commit
4ef9d41601
3 changed files with 2 additions and 5 deletions
|
@ -94,7 +94,6 @@ void CSRISubtitlesProvider::LoadSubtitles(AssFile *subs) {
|
|||
if (!renderer) {
|
||||
renderer = csri_renderer_default();
|
||||
if (!renderer) {
|
||||
delete subs;
|
||||
throw _T("No CSRI renderer available, cannot show subtitles. Try installing one or switch to another subtitle provider.");
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +102,6 @@ void CSRISubtitlesProvider::LoadSubtitles(AssFile *subs) {
|
|||
if (canOpenMem) {
|
||||
std::vector<char> data;
|
||||
subs->SaveMemory(data,_T("UTF-8"));
|
||||
delete subs;
|
||||
instance = csri_open_mem(renderer,&data[0],data.size(),NULL);
|
||||
}
|
||||
|
||||
|
@ -111,7 +109,6 @@ void CSRISubtitlesProvider::LoadSubtitles(AssFile *subs) {
|
|||
else {
|
||||
wxString subsFileName = VideoContext::Get()->GetTempWorkFile();
|
||||
subs->Save(subsFileName,false,false,_T("UTF-8"));
|
||||
delete subs;
|
||||
instance = csri_open_file(renderer,subsFileName.mb_str(wxConvUTF8),NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,7 +133,6 @@ void LibassSubtitlesProvider::LoadSubtitles(AssFile *subs) {
|
|||
// Prepare subtitles
|
||||
std::vector<char> data;
|
||||
subs->SaveMemory(data,_T("UTF-8"));
|
||||
delete subs;
|
||||
|
||||
// Load file
|
||||
if (ass_track) ass_free_track(ass_track);
|
||||
|
|
|
@ -350,7 +350,8 @@ void VideoContext::Refresh (bool video, bool subtitles) {
|
|||
AssExporter exporter(grid->ass);
|
||||
exporter.AddAutoFilters();
|
||||
try {
|
||||
subsProvider->LoadSubtitles(exporter.ExportTransform());
|
||||
std::auto_ptr<AssFile> exported(exporter.ExportTransform());
|
||||
subsProvider->LoadSubtitles(exported.get());
|
||||
}
|
||||
catch (wxString err) { wxMessageBox(_T("Error while invoking subtitles provider: ") + err,_T("Subtitles provider")); }
|
||||
catch (const wchar_t *err) { wxMessageBox(_T("Error while invoking subtitles provider: ") + wxString(err),_T("Subtitles provider")); }
|
||||
|
|
Loading…
Reference in a new issue