1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-20 14:20:06 +02:00

In DirManager.cpp, probably fixed bug 451, by not deleting over-long blockfile.

Made Sequence::HandleXMLEndTag log errors more specific.

Differentiated "Gap detected in project file" error messages.
This commit is contained in:
v.audacity 2011-10-12 05:40:23 +00:00
parent 7b04d6518d
commit 4d1e18d8fd
2 changed files with 12 additions and 5 deletions

View File

@ -1050,6 +1050,9 @@ bool DirManager::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
((mMaxSamples > -1) && // is initialized ((mMaxSamples > -1) && // is initialized
(pBlockFile->GetLength() > mMaxSamples))) (pBlockFile->GetLength() > mMaxSamples)))
{ {
// See http://bugzilla.audacityteam.org/show_bug.cgi?id=451#c13.
// Lock pBlockFile so that the ~BlockFile() will not delete the file on disk.
pBlockFile->Lock();
delete pBlockFile; delete pBlockFile;
return false; return false;
} }

View File

@ -827,7 +827,7 @@ void Sequence::HandleXMLEndTag(const wxChar *tag)
if (wxStrcmp(tag, wxT("sequence")) != 0) if (wxStrcmp(tag, wxT("sequence")) != 0)
return; return;
// Make sure that the sequence is valid // Make sure that the sequence is valid.
// First, replace missing blockfiles with SilentBlockFiles // First, replace missing blockfiles with SilentBlockFiles
unsigned int b; unsigned int b;
for (b = 0; b < mBlock->Count(); b++) { for (b = 0; b < mBlock->Count(); b++) {
@ -840,11 +840,15 @@ void Sequence::HandleXMLEndTag(const wxChar *tag)
len = mNumSamples - mBlock->Item(b)->start; len = mNumSamples - mBlock->Item(b)->start;
if (len > mMaxSamples) if (len > mMaxSamples)
{
// This could be why the blockfile failed, so limit // This could be why the blockfile failed, so limit
// the silent replacement to mMaxSamples. // the silent replacement to mMaxSamples.
len = mMaxSamples; len = mMaxSamples;
wxLogError(_(" Sequence has missing block file with length > mMaxSamples."));
}
mBlock->Item(b)->f = new SilentBlockFile(len); mBlock->Item(b)->f = new SilentBlockFile(len);
wxLogError(_("Gap detected in project file.")); wxLogError(
_("Gap detected in project file. Missing block file replaced with silence."));
mErrorOpening = true; mErrorOpening = true;
} }
} }
@ -854,14 +858,14 @@ void Sequence::HandleXMLEndTag(const wxChar *tag)
for (b = 0; b < mBlock->Count(); b++) { for (b = 0; b < mBlock->Count(); b++) {
if (mBlock->Item(b)->start != numSamples) { if (mBlock->Item(b)->start != numSamples) {
mBlock->Item(b)->start = numSamples; mBlock->Item(b)->start = numSamples;
wxLogError(_("Gap detected in project file.")); wxLogError(_("Gap detected in project file.\n Block specification for block file started after end of previous block.\n Start has been moved back so blocks are contiguous."));
mErrorOpening = true; mErrorOpening = true;
} }
numSamples += mBlock->Item(b)->f->GetLength(); numSamples += mBlock->Item(b)->f->GetLength();
} }
if (mNumSamples != numSamples) { if (mNumSamples != numSamples) {
mNumSamples = numSamples; mNumSamples = numSamples;
wxLogError(_("Gap detected in project file.")); wxLogError(_("Gap detected in project file. Sequence sample count corrected."));
mErrorOpening = true; mErrorOpening = true;
} }
} }