summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorsr55 <[email protected]>2011-05-26 18:29:04 +0000
committersr55 <[email protected]>2011-05-26 18:29:04 +0000
commit5a018b6c6863830910f16aaabd9afbe4ee0c3890 (patch)
tree85e292099b71f01826d4ec07cc1bf65876cb6ea7 /win
parenta879d4f33330f4aa1349199a9109ec855d113588 (diff)
WinGui: Fix to the Audio Panel. It now creates a copy of the sources Audio Tracks collection rather than using a reference. The reference was getting cleared out if the user re-selected a title which was causing a crash. Also added some extra sanity checking code in to prevent possible issues.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4005 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
-rw-r--r--win/CS/Controls/AudioPanel.cs11
1 files changed, 7 insertions, 4 deletions
diff --git a/win/CS/Controls/AudioPanel.cs b/win/CS/Controls/AudioPanel.cs
index 8b385d992..66b25c5b0 100644
--- a/win/CS/Controls/AudioPanel.cs
+++ b/win/CS/Controls/AudioPanel.cs
@@ -190,7 +190,7 @@ namespace Handbrake.Controls
{
if (selectedTitle.AudioTracks.Count == 0)
{
- audioList.Rows.Clear();
+ this.AudioTracks.Clear();
this.ScannedTracks.Clear();
this.ScannedTracks.Add(AudioHelper.NoneFound);
this.drp_audioTrack.Refresh();
@@ -201,7 +201,7 @@ namespace Handbrake.Controls
// Setup the Audio track source dropdown with the new audio tracks.
this.ScannedTracks.Clear();
this.drp_audioTrack.SelectedItem = null;
- this.ScannedTracks = new BindingList<Audio>(selectedTitle.AudioTracks);
+ this.ScannedTracks = new BindingList<Audio>(selectedTitle.AudioTracks.ToList());
drp_audioTrack.DataSource = this.ScannedTracks;
drp_audioTrack.SelectedItem = this.ScannedTracks.FirstOrDefault();
@@ -218,7 +218,10 @@ namespace Handbrake.Controls
}
}
- this.AutomaticTrackSelection();
+ if (this.AudioTracks.Count > 0)
+ {
+ this.AutomaticTrackSelection();
+ }
}
#endregion
@@ -555,7 +558,7 @@ namespace Handbrake.Controls
/// </summary>
private void AutomaticTrackSelection()
{
- if (drp_audioTrack.SelectedItem.ToString() == AudioHelper.NoneFound.Description)
+ if (drp_audioTrack.SelectedItem != null && drp_audioTrack.SelectedItem.ToString() == AudioHelper.NoneFound.Description)
{
this.AudioTracks.Clear();
return;