Fixed crash when clicking on "Open" file... (first commit from 2012)

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@1406 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2012-10-06 14:07:57 +00:00
parent dfc069486d
commit 0b64e3727b

View File

@ -160,6 +160,7 @@ namespace Nikse.SubtitleEdit.Forms
private string _lastDoNotPrompt = string.Empty;
private VideoInfo _videoInfo = null;
bool _splitDualSami = false;
bool _openFileDialogOn = false;
private bool AutoRepeatContinueOn
{
@ -1899,22 +1900,40 @@ namespace Nikse.SubtitleEdit.Forms
private void OpenToolStripMenuItemClick(object sender, EventArgs e)
{
openToolStripMenuItem.Enabled = false;
ReloadFromSourceView();
OpenNewFile();
openToolStripMenuItem.Enabled = true;
}
private void OpenNewFile()
{
if (_openFileDialogOn)
return;
_openFileDialogOn = true;
_lastDoNotPrompt = string.Empty;
if (!ContinueNewOrExit())
{
_openFileDialogOn = false;
return;
}
try
{
openFileDialog1.Title = _languageGeneral.OpenSubtitle;
openFileDialog1.FileName = string.Empty;
openFileDialog1.Filter = Utilities.GetOpenDialogFilter();
if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
OpenSubtitle(openFileDialog1.FileName, null);
}
catch
{
System.Diagnostics.Debug.WriteLine("Open file exception - might be called multiple times?");
}
finally
{
_openFileDialogOn = false;
}
}
public double CurrentFrameRate
{