1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-02 08:59:28 +02:00

When saving new project, put correct file name into MRU submenu...

... bug was introduced at 590d8c6d09fa2989f1e35ad3125965c801ece506
This commit is contained in:
Paul Licameli 2020-07-09 19:15:35 -04:00
parent 70ab645647
commit 7ad8849d32
2 changed files with 14 additions and 4 deletions

View File

@ -288,7 +288,10 @@ void ProjectFileIO::SaveConnection()
DiscardConnection(); DiscardConnection();
mPrevDB = mDB; mPrevDB = mDB;
mPrevFileName = mFileName;
mDB = nullptr; mDB = nullptr;
SetFileName({});
} }
// Close any set-aside connection // Close any set-aside connection
@ -305,6 +308,7 @@ void ProjectFileIO::DiscardConnection()
); );
} }
mPrevDB = nullptr; mPrevDB = nullptr;
mPrevFileName.clear();
} }
} }
@ -323,12 +327,17 @@ void ProjectFileIO::RestoreConnection()
} }
} }
mDB = mPrevDB; mDB = mPrevDB;
SetFileName(mPrevFileName);
mPrevDB = nullptr;
mPrevFileName.clear();
} }
void ProjectFileIO::UseConnection( sqlite3 *db ) void ProjectFileIO::UseConnection( sqlite3 *db, const FilePath &filePath )
{ {
wxASSERT(mDB == nullptr); wxASSERT(mDB == nullptr);
mDB = db; mDB = db;
SetFileName( filePath );
} }
sqlite3 *ProjectFileIO::OpenDB(FilePath fileName) sqlite3 *ProjectFileIO::OpenDB(FilePath fileName)
@ -1350,7 +1359,7 @@ bool ProjectFileIO::SaveProject(const FilePath &fileName)
// (also ensuring closing of one of the connections, with the cooperation // (also ensuring closing of one of the connections, with the cooperation
// of the finally above) // of the finally above)
SaveConnection(); SaveConnection();
UseConnection( newDB ); UseConnection( newDB, fileName );
} }
auto db = DB(); auto db = DB();

View File

@ -134,7 +134,7 @@ private:
void RestoreConnection(); void RestoreConnection();
// Use a connection that is already open rather than invoke OpenDB // Use a connection that is already open rather than invoke OpenDB
void UseConnection( sqlite3 *db ); void UseConnection( sqlite3 *db, const FilePath &filePath );
sqlite3 *OpenDB(FilePath fileName = {}); sqlite3 *OpenDB(FilePath fileName = {});
bool CloseDB(); bool CloseDB();
@ -185,8 +185,9 @@ private:
bool mBypass; bool mBypass;
sqlite3 *mPrevDB; sqlite3 *mPrevDB;
FilePath mPrevFileName;
sqlite3 *mDB; sqlite3 *mDB;
FilePath mDBPath;
TranslatableString mLastError; TranslatableString mLastError;
TranslatableString mLibraryError; TranslatableString mLibraryError;