MCPcopy Create free account
hub / github.com/audacity/audacity / DiscardConnection

Method DiscardConnection

libraries/lib-project-file-io/ProjectFileIO.cpp:577–608  ·  view source on GitHub ↗

Close any set-aside connection

Source from the content-addressed store, hash-verified

575
576// Close any set-aside connection
577void ProjectFileIO::DiscardConnection()
578{
579 if (mPrevConn)
580 {
581 if (!mPrevConn->Close())
582 {
583 // Store an error message
584 SetDBError(
585 XO("Failed to discard connection")
586 );
587 }
588
589 // If this is a temporary project, we no longer want to keep the
590 // project file.
591 if (mPrevTemporary)
592 {
593 // This is just a safety check.
594 wxFileName temp(TempDirectory::TempDir(), wxT(""));
595 wxFileName file(mPrevFileName);
596 file.SetFullName(wxT(""));
597 if (file == temp)
598 {
599 if (!RemoveProject(mPrevFileName))
600 {
601 wxLogMessage("Failed to remove temporary project %s", mPrevFileName);
602 }
603 }
604 }
605 mPrevConn = nullptr;
606 mPrevFileName.clear();
607 }
608}
609
610// Close any current connection and switch back to using the saved
611void ProjectFileIO::RestoreConnection()

Callers 1

CommitMethod · 0.80

Calls 2

CloseMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected