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