Fixed locking of input subtitle file + crash after unsuccessful load of subtitle file - thx darnn :)

Fix #2306
This commit is contained in:
Nikolaj Olsson 2017-03-23 17:34:00 +01:00
parent 9f2d437234
commit 82e9f4464b
2 changed files with 19 additions and 11 deletions

View File

@ -19,7 +19,9 @@
* Fixed issue regarding "Fix dialogs on one line" - thx ingo
* Fixed possible crash in EBU STL - thx Elena
* Video player "Stop" resets playback position - thx askolesov/pavel-belenko
* Many fixes for Timed Text 1.0 and Netflix Timed Text - thx askolesov/pavel-belenko
* Many fixes for TTML 1.0 and Netflix Timed Text - thx askolesov/pavel-belenko
* Fixed locking of input subtitle (for unknown subtitles) - thx darnn
* Fixed crash after unsuccessful load of file - thx darnn
3.5.2 (3rd March 2017)

View File

@ -1980,13 +1980,17 @@ namespace Nikse.SubtitleEdit.Forms
return;
}
var tempSubtitle = new Subtitle(_subtitle, false);
if (_subtitle.HistoryItems.Count > 0 || _subtitle.Paragraphs.Count > 0)
MakeHistoryForUndo(string.Format(_language.BeforeLoadOf, Path.GetFileName(fileName)));
string _subtitleHash = _subtitle.GetFastHashCode();
bool hasChanged = (_changeSubtitleToString != _subtitleHash) && (_lastDoNotPrompt != _subtitleHash);
string subtitleHash = _subtitle.GetFastHashCode();
bool hasChanged = (_changeSubtitleToString != subtitleHash) && (_lastDoNotPrompt != subtitleHash);
SubtitleFormat format = _subtitle.LoadSubtitle(fileName, out encoding, encoding);
if (format == null)
_subtitle = tempSubtitle;
if (!hasChanged)
_changeSubtitleToString = _subtitle.GetFastHashCode();
@ -2633,14 +2637,16 @@ namespace Nikse.SubtitleEdit.Forms
// retry Matroska (file with wrong extension)
if (format == null && !string.IsNullOrWhiteSpace(fileName))
{
var matroska = new MatroskaFile(fileName);
if (matroska.IsValid)
using (var matroska = new MatroskaFile(fileName))
{
var subtitleList = matroska.GetTracks(true);
if (subtitleList.Count > 0)
if (matroska.IsValid)
{
ImportSubtitleFromMatroskaFile(fileName);
return;
var subtitleList = matroska.GetTracks(true);
if (subtitleList.Count > 0)
{
ImportSubtitleFromMatroskaFile(fileName);
return;
}
}
}
}
@ -20741,7 +20747,7 @@ namespace Nikse.SubtitleEdit.Forms
string msgFormat = string.Format("{0} {1}",
Configuration.Settings.Language.NetflixQualityCheck.GlyphCheckFailed,
Configuration.Settings.Language.NetflixQualityCheck.ReportPrompt);
messages.Add(string.Format(msgFormat , reportPath));
messages.Add(string.Format(msgFormat, reportPath));
reportFiles.Add(reportPath);
}
@ -20794,7 +20800,7 @@ namespace Nikse.SubtitleEdit.Forms
messages.Add(Configuration.Settings.Language.NetflixQualityCheck.WhiteSpaceCheckSuccessfull);
}
if (messages.Count != 0)
{
NetflixQCResult dialog = new NetflixQCResult(string.Join(Environment.NewLine, messages), reportFiles);