From 045bedfe04128178ab27ca982ec055944f8c88cb Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Mon, 23 Nov 2020 16:44:59 -0500 Subject: [PATCH] Simplify two GuardedCalls into one --- src/DBConnection.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/DBConnection.cpp b/src/DBConnection.cpp index aa54c9536..56a0426d0 100644 --- a/src/DBConnection.cpp +++ b/src/DBConnection.cpp @@ -349,25 +349,19 @@ 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(); } + SimpleGuard{}, + [&](AudacityException * e) { + // This executes in the main thread. + OnStopAudio(); + if (e) + e->DelayedHandlerAction(); + } ); - - // 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" }; } - ); } } }