1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-02-07 20:22:13 +01:00

(bug 451, P2) Add more error checking and increase specificity of Sequence-reading code.

Add wxLogWarning messages to AudacityProject::OpenFile()

Fixed correction for "A linked track's partner should never itself be linked" to remove the link from the partner, not the original (left).

Fix possible NULL pointer dereference in previous commit.
This commit is contained in:
v.audacity
2011-10-13 22:52:55 +00:00
parent 5697e39ec0
commit 1f352b0157
3 changed files with 70 additions and 28 deletions

View File

@@ -2423,7 +2423,12 @@ void AudacityProject::OpenFile(wxString fileName, bool addtohistory)
t = iter.First();
while (t) {
if (t->GetErrorOpening())
{
wxLogWarning(
wxT("Track %s had error reading clip values from project file."),
t->GetName().c_str());
err = true;
}
// Sanity checks for linked tracks; unsetting the linked property
// doesn't fix the problem, but it likely leaves us with orphaned
@@ -2436,8 +2441,11 @@ void AudacityProject::OpenFile(wxString fileName, bool addtohistory)
// A linked track's partner should never itself be linked
if (l->GetLinked())
{
wxLogWarning(
wxT("Left track %s had linked right track %s with extra right track link.\n Removing extra link from right track."),
t->GetName().c_str(), l->GetName().c_str());
err = true;
t->SetLinked(false);
l->SetLinked(false);
}
// Channels should be left and right
@@ -2446,12 +2454,18 @@ void AudacityProject::OpenFile(wxString fileName, bool addtohistory)
(t->GetChannel() == Track::RightChannel &&
l->GetChannel() == Track::LeftChannel) ) )
{
wxLogWarning(
wxT("Track %s and %s had left/right track links out of order. Setting tracks to not be linked."),
t->GetName().c_str(), l->GetName().c_str());
err = true;
t->SetLinked(false);
}
}
else
{
wxLogWarning(
wxT("Track %s had link to NULL track. Setting it to not be linked."),
t->GetName().c_str());
err = true;
t->SetLinked(false);
}