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

Simplify two GuardedCalls into one

This commit is contained in:
Paul Licameli 2020-11-23 16:44:59 -05:00
parent e08fe884e3
commit 045bedfe04

View File

@ -349,24 +349,18 @@ void DBConnection::CheckpointThread()
// Stop trying to checkpoint
giveUp = true;
// Stop the audio.
// OnStopAudio happens in the main thread.
GuardedCall(
[&message] {
throw SimpleMessageBoxException{
message, XO("Warning"), "Error:_Disk_full_or_not_writable" }; },
[&](AudacityException * e) {; },
[&](AudacityException * e) { OnStopAudio(); }
);
// The message box in the previous GuardedCall is swallowed,
// so send it again....
// Throw and catch and AudacityException, enqueuing the
// error message box for the event loop in the main thread
GuardedCall([&message] {
throw SimpleMessageBoxException{
message, XO("Warning"), "Error:_Disk_full_or_not_writable" }; }
SimpleGuard<void>{},
[&](AudacityException * e) {
// This executes in the main thread.
OnStopAudio();
if (e)
e->DelayedHandlerAction();
}
);
}
}