1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-04-11 16:50:25 +02:00

Bug2596: Error dialogs opening unreadable project should not be blank

This commit is contained in:
Paul Licameli
2020-11-24 12:38:19 -05:00
parent 54359fbefd
commit 5ebfe4670c
4 changed files with 34 additions and 25 deletions

View File

@@ -247,6 +247,7 @@ const ProjectFileIO &ProjectFileIO::Get( const AudacityProject &project )
ProjectFileIO::ProjectFileIO(AudacityProject &project)
: mProject{ project }
, mpErrors{ std::make_shared<DBConnectionErrors>() }
{
mPrevConn = nullptr;
@@ -318,7 +319,8 @@ bool ProjectFileIO::OpenConnection(FilePath fileName /* = {} */)
}
// Pass weak_ptr to project into DBConnection constructor
curConn = std::make_unique<DBConnection>(mProject.shared_from_this());
curConn = std::make_unique<DBConnection>(
mProject.shared_from_this(), mpErrors);
if (!curConn->Open(fileName))
{
curConn.reset();
@@ -2049,7 +2051,8 @@ bool ProjectFileIO::SaveProject(
}
// Open the newly created database
Connection newConn = std::make_unique<DBConnection>(mProject.shared_from_this());
Connection newConn = std::make_unique<DBConnection>(
mProject.shared_from_this(), mpErrors);
// NOTE: There is a noticeable delay here when dealing with large multi-hour
// projects that we just created. The delay occurs in Open() when it
@@ -2270,14 +2273,12 @@ wxLongLong ProjectFileIO::GetFreeDiskSpace() const
const TranslatableString &ProjectFileIO::GetLastError()
{
auto &currConn = CurrConn();
return currConn->GetLastError();
return mpErrors->mLastError;
}
const TranslatableString &ProjectFileIO::GetLibraryError()
{
auto &currConn = CurrConn();
return currConn->GetLibraryError();
return mpErrors->mLibraryError;
}
void ProjectFileIO::SetError(