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 string _lastDoNotPrompt = string.Empty;
private VideoInfo _videoInfo = null; private VideoInfo _videoInfo = null;
bool _splitDualSami = false; bool _splitDualSami = false;
bool _openFileDialogOn = false;
private bool AutoRepeatContinueOn private bool AutoRepeatContinueOn
{ {
@ -1899,21 +1900,39 @@ namespace Nikse.SubtitleEdit.Forms
private void OpenToolStripMenuItemClick(object sender, EventArgs e) private void OpenToolStripMenuItemClick(object sender, EventArgs e)
{ {
openToolStripMenuItem.Enabled = false;
ReloadFromSourceView(); ReloadFromSourceView();
OpenNewFile(); OpenNewFile();
openToolStripMenuItem.Enabled = true;
} }
private void OpenNewFile() private void OpenNewFile()
{ {
if (_openFileDialogOn)
return;
_openFileDialogOn = true;
_lastDoNotPrompt = string.Empty; _lastDoNotPrompt = string.Empty;
if (!ContinueNewOrExit()) if (!ContinueNewOrExit())
{
_openFileDialogOn = false;
return; return;
openFileDialog1.Title = _languageGeneral.OpenSubtitle; }
openFileDialog1.FileName = string.Empty; try
openFileDialog1.Filter = Utilities.GetOpenDialogFilter(); {
openFileDialog1.Title = _languageGeneral.OpenSubtitle;
if (openFileDialog1.ShowDialog(this) == DialogResult.OK) openFileDialog1.FileName = string.Empty;
OpenSubtitle(openFileDialog1.FileName, null); 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 public double CurrentFrameRate