mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-16 08:34:10 +02:00
Allow exceptions from BlockFile::Recover, handle them in ProjectFSCK
This commit is contained in:
parent
f508493561
commit
d11027c2a7
@ -149,6 +149,7 @@ class PROFILE_DLL_API BlockFile /* not final, abstract */ {
|
||||
//summary only), write out a placeholder of silence data (missing
|
||||
//.au) or mark the blockfile to deal some other way without spewing
|
||||
//errors.
|
||||
// May throw exceptions for i/o errors.
|
||||
virtual void Recover() = 0;
|
||||
/// if we've detected an on-disk problem, the user opted to
|
||||
//continue and the error persists, don't keep reporting it. The
|
||||
|
@ -88,6 +88,7 @@
|
||||
#endif
|
||||
|
||||
#include "AudacityApp.h"
|
||||
#include "AudacityException.h"
|
||||
#include "BlockFile.h"
|
||||
#include "blockfile/LegacyBlockFile.h"
|
||||
#include "blockfile/LegacyAliasBlockFile.h"
|
||||
@ -1609,10 +1610,8 @@ _("Project check of \"%s\" folder \
|
||||
wxASSERT(b);
|
||||
if (b) {
|
||||
auto ab = static_cast< AliasBlockFile * > ( &*b );
|
||||
if (action == 1)
|
||||
// Silence error logging for this block in this session.
|
||||
ab->SilenceAliasLog();
|
||||
else if (action == 2)
|
||||
|
||||
if (action == 2)
|
||||
{
|
||||
// silence the blockfiles by yanking the filename
|
||||
// This is done, eventually, in PCMAliasBlockFile::ReadData()
|
||||
@ -1621,9 +1620,22 @@ _("Project check of \"%s\" folder \
|
||||
wxFileNameWrapper dummy;
|
||||
dummy.Clear();
|
||||
ab->ChangeAliasedFileName(std::move(dummy));
|
||||
ab->Recover();
|
||||
|
||||
// If recovery fails for one file, silence it,
|
||||
// and don't try to recover other files but
|
||||
// silence them too. GuardedCall will cause an appropriate
|
||||
// error message for the user.
|
||||
GuardedCall<void>(
|
||||
[&] { ab->Recover(); },
|
||||
[&] (AudacityException*) { action = 1; }
|
||||
);
|
||||
|
||||
nResult = FSCKstatus_CHANGED | FSCKstatus_SAVE_AUP;
|
||||
}
|
||||
|
||||
if (action == 1)
|
||||
// Silence error logging for this block in this session.
|
||||
ab->SilenceAliasLog();
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
@ -1673,11 +1685,22 @@ _("Project check of \"%s\" folder \
|
||||
BlockFilePtr b = iter->second.lock();
|
||||
wxASSERT(b);
|
||||
if (b) {
|
||||
if(action==0){
|
||||
if(action==0) {
|
||||
//regenerate from data
|
||||
b->Recover();
|
||||
nResult |= FSCKstatus_CHANGED;
|
||||
}else if (action==1){
|
||||
// If recovery fails for one file, silence it,
|
||||
// and don't try to recover other files but
|
||||
// silence them too. GuardedCall will cause an appropriate
|
||||
// error message for the user.
|
||||
GuardedCall<void>(
|
||||
[&] {
|
||||
b->Recover();
|
||||
nResult |= FSCKstatus_CHANGED;
|
||||
},
|
||||
[&] (AudacityException*) { action = 1; }
|
||||
);
|
||||
}
|
||||
|
||||
if (action==1){
|
||||
// Silence error logging for this block in this session.
|
||||
b->SilenceLog();
|
||||
}
|
||||
@ -1737,11 +1760,22 @@ _("Project check of \"%s\" folder \
|
||||
if (b) {
|
||||
if (action == 2)
|
||||
{
|
||||
//regenerate with zeroes
|
||||
b->Recover();
|
||||
nResult = FSCKstatus_CHANGED;
|
||||
//regenerate from data
|
||||
// If recovery fails for one file, silence it,
|
||||
// and don't try to recover other files but
|
||||
// silence them too. GuardedCall will cause an appropriate
|
||||
// error message for the user.
|
||||
GuardedCall<void>(
|
||||
[&] {
|
||||
//regenerate with zeroes
|
||||
b->Recover();
|
||||
nResult |= FSCKstatus_CHANGED;
|
||||
},
|
||||
[&] (AudacityException*) { action = 1; }
|
||||
);
|
||||
}
|
||||
else if (action == 1)
|
||||
|
||||
if (action == 1)
|
||||
b->SilenceLog();
|
||||
}
|
||||
++iter;
|
||||
|
Loading…
x
Reference in New Issue
Block a user