1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-09 17:07:43 +02:00

Bug 2546 - Recording onto a nearly full disk results in two error messages re "disk full"

This commit is contained in:
James Crook 2020-10-28 12:38:15 +00:00
parent 2cc6dccc5d
commit 3978e8c9ee

View File

@ -21,6 +21,10 @@ Paul Licameli -- split from ProjectFileIO.cpp
#include "FileException.h"
#include "wxFileNameWrapper.h"
#include "./commands/CommandContext.h"
#include "./ProjectAudioManager.h"
// Configuration to provide "safe" connections
static const char *SafeConfig =
"PRAGMA <schema>.locking_mode = SHARED;"
@ -276,6 +280,13 @@ sqlite3_stmt *DBConnection::GetStatement(enum StatementID id)
return iter->second;
}
void OnStopAudio()
{
ProjectAudioManager::Get( *GetActiveProject() ).Stop();
}
void DBConnection::CheckpointThread()
{
// Open another connection to the DB to prevent blocking the main thread.
@ -335,14 +346,28 @@ void DBConnection::CheckpointThread()
"For tips on freeing up space, click the help button."
).Format(message1);
// 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" }; } );
// Stop trying to checkpoint
giveUp = true;
message, XO("Warning"), "Error:_Disk_full_or_not_writable" }; }
);
}
}
}