Fixed a few leaks

This commit is contained in:
niksedk 2014-10-05 00:22:33 +02:00
parent cdbc5f083d
commit a57e593411

View File

@ -6278,6 +6278,7 @@ namespace Nikse.SubtitleEdit.Forms
RefreshSelectedParagraph();
}
}
form.Dispose();
}
private void WebVTTRemoveVoices(object sender, EventArgs e)
@ -6336,6 +6337,7 @@ namespace Nikse.SubtitleEdit.Forms
}
}
}
form.Dispose();
}
private void BoldToolStripMenuItemClick(object sender, EventArgs e)
@ -10966,7 +10968,8 @@ namespace Nikse.SubtitleEdit.Forms
}
else
{
Watermark watermarkForm = new Watermark();
using (var watermarkForm = new Watermark())
{
watermarkForm.Initialize(_subtitle, FirstSelectedIndex);
if (watermarkForm.ShowDialog(this) == DialogResult.OK)
{
@ -10975,6 +10978,7 @@ namespace Nikse.SubtitleEdit.Forms
}
}
}
}
else if (e.Modifiers == (Keys.Control | Keys.Alt | Keys.Shift) && e.KeyCode == Keys.F) // Toggle HHMMSSFF / HHMMSSMMM
{
Configuration.Settings.General.UseTimeFormatHHMMSSFF = !Configuration.Settings.General.UseTimeFormatHHMMSSFF;
@ -11119,13 +11123,15 @@ namespace Nikse.SubtitleEdit.Forms
}
else if (e.Modifiers == (Keys.Control | Keys.Alt | Keys.Shift) && e.KeyCode == Keys.I) // watermak
{
var form = new ImportUnknownFormat(string.Empty);
using (var form = new ImportUnknownFormat(string.Empty))
{
if (form.ShowDialog(this) == DialogResult.OK)
{
_subtitle = form.ImportedSubitle;
_fileName = null;
SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
}
}
e.SuppressKeyPress = true;
}
else if ((textBoxListViewText.Focused || (SubtitleListview1.Focused && SubtitleListview1.SelectedItems.Count == 1) || (audioVisualizer.Focused && SubtitleListview1.SelectedItems.Count == 1)) && _mainTextBoxMoveLastWordDown == e.KeyData)
@ -14592,9 +14598,11 @@ namespace Nikse.SubtitleEdit.Forms
_timerCheckForUpdates.Stop();
if (_checkForUpdatesHelper.IsUpdateAvailable())
{
var form = new CheckForUpdates(this, _checkForUpdatesHelper);
using (var form = new CheckForUpdates(this, _checkForUpdatesHelper))
{
form.ShowDialog(this);
}
}
_checkForUpdatesHelper = null;
_timerCheckForUpdates = null;
}
@ -15228,7 +15236,8 @@ namespace Nikse.SubtitleEdit.Forms
}
mediaPlayer.Pause();
var addWaveform = new AddWaveform();
using (var addWaveform = new AddWaveform())
{
string peakWaveFileName = GetPeakWaveFileName(_videoFileName);
string spectrogramFolder = GetSpectrogramFolder(_videoFileName);
addWaveform.Initialize(_videoFileName, spectrogramFolder, _videoAudioTrackNumber);
@ -15245,6 +15254,7 @@ namespace Nikse.SubtitleEdit.Forms
}
}
}
}
private void timerWaveform_Tick(object sender, EventArgs e)
{
@ -15592,7 +15602,8 @@ namespace Nikse.SubtitleEdit.Forms
return;
}
var addWaveform = new AddWaveform();
using (var addWaveform = new AddWaveform())
{
string spectrogramFolder = GetSpectrogramFolder(_videoFileName);
addWaveform.InitializeViaWaveFile(fileName, spectrogramFolder);
if (addWaveform.ShowDialog() == DialogResult.OK)
@ -15605,6 +15616,7 @@ namespace Nikse.SubtitleEdit.Forms
timerWaveform.Start();
}
}
}
private void toolStripMenuItemImportBluRaySup_Click(object sender, EventArgs e)
{
@ -18819,7 +18831,8 @@ namespace Nikse.SubtitleEdit.Forms
private void GuessTimeCodesToolStripMenuItemClick(object sender, EventArgs e)
{
var form = new WaveformGenerateTimeCodes();
using (var form = new WaveformGenerateTimeCodes())
{
if (form.ShowDialog(this) == DialogResult.OK)
{
MakeHistoryForUndoOnlyIfNotResent(string.Format(_language.BeforeGuessingTimeCodes));
@ -18847,6 +18860,7 @@ namespace Nikse.SubtitleEdit.Forms
RefreshSelectedParagraph();
}
}
}
private void DvdStudioProStl_Click(object sender, EventArgs e)
{
@ -18988,6 +19002,7 @@ namespace Nikse.SubtitleEdit.Forms
SubtitleListview1.SelectIndexAndEnsureVisible(index, true);
RefreshSelectedParagraph();
}
form.Dispose();
}
}
@ -19244,13 +19259,13 @@ namespace Nikse.SubtitleEdit.Forms
private void toolStripMenuItemBatchConvert_Click(object sender, EventArgs e)
{
this.Visible = false;
Visible = false;
var form = new BatchConvert(this.Icon);
_formPositionsAndSizes.SetPositionAndSize(form);
form.ShowDialog(this);
_formPositionsAndSizes.SavePositionAndSize(form);
form.Dispose();
this.Visible = true;
Visible = true;
}
private void copyOriginalTextToCurrentToolStripMenuItem_Click(object sender, EventArgs e)
@ -19417,10 +19432,10 @@ namespace Nikse.SubtitleEdit.Forms
private void toolStripMenuItemImportOcrHardSub_Click(object sender, EventArgs e)
{
var form = new HardSubExtract(_videoFileName);
using (var form = new HardSubExtract(_videoFileName))
{
if (form.ShowDialog(this) == DialogResult.OK)
{
if (!string.IsNullOrEmpty(form.OcrFileName))
{
MakeHistoryForUndo(_language.BeforeAutoBalanceSelectedLines); //TODO: Fix text
@ -19428,6 +19443,7 @@ namespace Nikse.SubtitleEdit.Forms
}
}
}
}
private void toolStripMenuItemExportFcpIImage_Click(object sender, EventArgs e)
{
@ -19461,11 +19477,13 @@ namespace Nikse.SubtitleEdit.Forms
private void toolStripMenuItemMeasurementConverter_Click(object sender, EventArgs e)
{
var form = new MeasurementConverter();
using (var form = new MeasurementConverter())
{
_formPositionsAndSizes.SetPositionAndSize(form);
form.Show(this);
// _formPositionsAndSizes.SavePositionAndSize(form);
}
}
private void toolStripMenuItemImportSceneChanges_Click(object sender, EventArgs e)
{
@ -19741,8 +19759,10 @@ namespace Nikse.SubtitleEdit.Forms
{
}
var form = new CheckForUpdates(this);
using (var form = new CheckForUpdates(this))
{
form.ShowDialog(this);
}
Configuration.Settings.General.LastCheckForUpdates = DateTime.Now;
}