1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-31 16:09: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();
mPrevDB = mDB;
mPrevFileName = mFileName;
mDB = nullptr;
SetFileName({});
}
// Close any set-aside connection
@ -305,6 +308,7 @@ void ProjectFileIO::DiscardConnection()
);
}
mPrevDB = nullptr;
mPrevFileName.clear();
}
}
@ -323,12 +327,17 @@ void ProjectFileIO::RestoreConnection()
}
}
mDB = mPrevDB;
SetFileName(mPrevFileName);
mPrevDB = nullptr;
mPrevFileName.clear();
}
void ProjectFileIO::UseConnection( sqlite3 *db )
void ProjectFileIO::UseConnection( sqlite3 *db, const FilePath &filePath )
{
wxASSERT(mDB == nullptr);
mDB = db;
SetFileName( filePath );
}
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
// of the finally above)
SaveConnection();
UseConnection( newDB );
UseConnection( newDB, fileName );
}
auto db = DB();

View File

@ -134,7 +134,7 @@ private:
void RestoreConnection();
// 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 = {});
bool CloseDB();
@ -185,8 +185,9 @@ private:
bool mBypass;
sqlite3 *mPrevDB;
FilePath mPrevFileName;
sqlite3 *mDB;
FilePath mDBPath;
TranslatableString mLastError;
TranslatableString mLibraryError;