1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-03-22 22:25:47 +01:00

Bug2442 residual: Review AudacityException classes...

... Have copy constructors only (no moves); disallow all assignments
This commit is contained in:
Paul Licameli
2020-06-05 13:43:10 -04:00
parent 13ec3300a9
commit 4a56af43aa
6 changed files with 18 additions and 50 deletions

View File

@@ -1835,39 +1835,38 @@ void Sequence::ConsistencyCheck
sampleCount mNumSamples, const wxChar *whereStr,
bool WXUNUSED(mayThrow))
{
bool bError = false;
// Construction of the exception at the appropriate line of the function
// gives a little more discrimination
InconsistencyException ex;
Optional<InconsistencyException> ex;
unsigned int numBlocks = mBlock.size();
unsigned int i;
sampleCount pos = from < numBlocks ? mBlock[from].start : mNumSamples;
if ( from == 0 && pos != 0 )
ex = CONSTRUCT_INCONSISTENCY_EXCEPTION, bError = true;
ex.emplace( CONSTRUCT_INCONSISTENCY_EXCEPTION );
for (i = from; !bError && i < numBlocks; i++) {
for (i = from; !ex && i < numBlocks; i++) {
const SeqBlock &seqBlock = mBlock[i];
if (pos != seqBlock.start)
ex = CONSTRUCT_INCONSISTENCY_EXCEPTION, bError = true;
ex.emplace( CONSTRUCT_INCONSISTENCY_EXCEPTION );
if ( seqBlock.f ) {
const auto length = seqBlock.f->GetLength();
if (length > maxSamples)
ex = CONSTRUCT_INCONSISTENCY_EXCEPTION, bError = true;
ex.emplace( CONSTRUCT_INCONSISTENCY_EXCEPTION );
pos += length;
}
else
ex = CONSTRUCT_INCONSISTENCY_EXCEPTION, bError = true;
ex.emplace( CONSTRUCT_INCONSISTENCY_EXCEPTION );
}
if ( !bError && pos != mNumSamples )
ex = CONSTRUCT_INCONSISTENCY_EXCEPTION, bError = true;
if ( !ex && pos != mNumSamples )
ex.emplace( CONSTRUCT_INCONSISTENCY_EXCEPTION );
if ( bError )
if ( ex )
{
wxLogError(wxT("*** Consistency check failed at %d after %s. ***"),
ex.GetLine(), whereStr);
ex->GetLine(), whereStr);
wxString str;
DebugPrintf(mBlock, mNumSamples, &str);
wxLogError(wxT("%s"), str);
@@ -1876,7 +1875,7 @@ void Sequence::ConsistencyCheck
wxT("Undo the failed operation(s), then export or save your work and quit."));
//if (mayThrow)
//throw ex;
//throw *ex;
//else
wxASSERT(false);
}