1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-15 15:49:36 +02:00

Fix crash on exit, which could be seen at least on Mac, if you...

... Start Audacity; generate some noise; shift clip with Time-Shift tool;
command+Q to exit; say No to save changes.

The scope of a GuardedCall needs to be expanded, because Conn() can throw,
so that no exceptions escape the destructor of SqliteSampleBlock.

But now there is an error dialog on exit instead of a crash.
This commit is contained in:
Paul Licameli 2020-09-14 15:07:32 -04:00
parent c5c7a6d08a
commit cbd21c5fff

View File

@ -315,6 +315,7 @@ SqliteSampleBlock::~SqliteSampleBlock()
}
// See ProjectFileIO::Bypass() for a description of mIO.mBypass
GuardedCall( [this]{
if (!mLocked && !Conn()->ShouldBypass())
{
// In case Delete throws, don't let an exception escape a destructor,
@ -322,8 +323,9 @@ SqliteSampleBlock::~SqliteSampleBlock()
// is presented to the user.
// The failure in this case may be a less harmful waste of space in the
// database, which should not cause aborting of the attempted edit.
GuardedCall( [this]{ Delete(); } );
Delete();
}
} );
}
DBConnection *SqliteSampleBlock::Conn() const