mirror of
https://github.com/cookiengineer/audacity
synced 2025-04-30 07:39:42 +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:
parent
c5c7a6d08a
commit
cbd21c5fff
@ -315,15 +315,17 @@ SqliteSampleBlock::~SqliteSampleBlock()
|
||||
}
|
||||
|
||||
// See ProjectFileIO::Bypass() for a description of mIO.mBypass
|
||||
if (!mLocked && !Conn()->ShouldBypass())
|
||||
{
|
||||
// In case Delete throws, don't let an exception escape a destructor,
|
||||
// but we can still enqueue the delayed handler so that an error message
|
||||
// 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(); } );
|
||||
}
|
||||
GuardedCall( [this]{
|
||||
if (!mLocked && !Conn()->ShouldBypass())
|
||||
{
|
||||
// In case Delete throws, don't let an exception escape a destructor,
|
||||
// but we can still enqueue the delayed handler so that an error message
|
||||
// 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.
|
||||
Delete();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
DBConnection *SqliteSampleBlock::Conn() const
|
||||
|
Loading…
x
Reference in New Issue
Block a user