mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-17 16:40:07 +02:00
Comments; range-for; fix unchecked dereferences of pointer-to-pointer
This commit is contained in:
parent
77b60ebbbb
commit
c96d5f12bc
@ -1487,7 +1487,8 @@ bool AudacityApp::InitPart2()
|
|||||||
// Auto-recovery
|
// Auto-recovery
|
||||||
//
|
//
|
||||||
bool didRecoverAnything = false;
|
bool didRecoverAnything = false;
|
||||||
if (!ShowAutoRecoveryDialogIfNeeded(&project, &didRecoverAnything))
|
// This call may reassign project (passed by reference)
|
||||||
|
if (!ShowAutoRecoveryDialogIfNeeded(project, &didRecoverAnything))
|
||||||
{
|
{
|
||||||
QuitAudacity(true);
|
QuitAudacity(true);
|
||||||
}
|
}
|
||||||
@ -1495,7 +1496,7 @@ bool AudacityApp::InitPart2()
|
|||||||
//
|
//
|
||||||
// Remainder of command line parsing, but only if we didn't recover
|
// Remainder of command line parsing, but only if we didn't recover
|
||||||
//
|
//
|
||||||
if (!didRecoverAnything)
|
if (project && !didRecoverAnything)
|
||||||
{
|
{
|
||||||
if (parser->Found(wxT("t")))
|
if (parser->Found(wxT("t")))
|
||||||
{
|
{
|
||||||
|
@ -36,7 +36,7 @@ enum {
|
|||||||
class AutoRecoveryDialog final : public wxDialogWrapper
|
class AutoRecoveryDialog final : public wxDialogWrapper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AutoRecoveryDialog(AudacityProject *proj);
|
explicit AutoRecoveryDialog(AudacityProject *proj);
|
||||||
|
|
||||||
bool HasRecoverables() const;
|
bool HasRecoverables() const;
|
||||||
FilePaths GetRecoverables();
|
FilePaths GetRecoverables();
|
||||||
@ -417,7 +417,7 @@ void AutoRecoveryDialog::OnListKeyDown(wxKeyEvent &evt)
|
|||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static bool RecoverAllProjects(const FilePaths &files,
|
static bool RecoverAllProjects(const FilePaths &files,
|
||||||
AudacityProject **pproj)
|
AudacityProject *&pproj)
|
||||||
{
|
{
|
||||||
// Open a project window for each auto save file
|
// Open a project window for each auto save file
|
||||||
wxString filename;
|
wxString filename;
|
||||||
@ -425,12 +425,9 @@ static bool RecoverAllProjects(const FilePaths &files,
|
|||||||
for (auto &file: files)
|
for (auto &file: files)
|
||||||
{
|
{
|
||||||
AudacityProject *proj = nullptr;
|
AudacityProject *proj = nullptr;
|
||||||
if (*pproj)
|
// Reuse any existing project window, which will be the empty project
|
||||||
{
|
// created at application startup
|
||||||
// Reuse existing project window
|
std::swap(proj, pproj);
|
||||||
proj = *pproj;
|
|
||||||
*pproj = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Open project.
|
// Open project.
|
||||||
if (ProjectManager::OpenProject(proj, file, false) == nullptr)
|
if (ProjectManager::OpenProject(proj, file, false) == nullptr)
|
||||||
@ -449,7 +446,7 @@ static void DiscardAllProjects(const FilePaths &files)
|
|||||||
ProjectFileManager::DiscardAutosave(file);
|
ProjectFileManager::DiscardAutosave(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ShowAutoRecoveryDialogIfNeeded(AudacityProject **pproj, bool *didRecoverAnything)
|
bool ShowAutoRecoveryDialogIfNeeded(AudacityProject *&pproj, bool *didRecoverAnything)
|
||||||
{
|
{
|
||||||
if (didRecoverAnything)
|
if (didRecoverAnything)
|
||||||
{
|
{
|
||||||
@ -472,7 +469,7 @@ bool ShowAutoRecoveryDialogIfNeeded(AudacityProject **pproj, bool *didRecoverAny
|
|||||||
// This must be done before "dlg" is declared.
|
// This must be done before "dlg" is declared.
|
||||||
wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI);
|
wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI);
|
||||||
|
|
||||||
AutoRecoveryDialog dialog(*pproj);
|
AutoRecoveryDialog dialog(pproj);
|
||||||
|
|
||||||
if (dialog.HasRecoverables())
|
if (dialog.HasRecoverables())
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@ class AudacityProject;
|
|||||||
// The didRecoverAnything param is strictly for a return value.
|
// The didRecoverAnything param is strictly for a return value.
|
||||||
// Any value passed in is ignored.
|
// Any value passed in is ignored.
|
||||||
//
|
//
|
||||||
bool ShowAutoRecoveryDialogIfNeeded(AudacityProject** pproj,
|
bool ShowAutoRecoveryDialogIfNeeded(AudacityProject*& pproj,
|
||||||
bool *didRecoverAnything);
|
bool *didRecoverAnything);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -868,9 +868,7 @@ void ProjectManager::OpenFiles(AudacityProject *proj)
|
|||||||
Importer::SetLastOpenType({});
|
Importer::SetLastOpenType({});
|
||||||
} );
|
} );
|
||||||
|
|
||||||
for (size_t ff = 0; ff < selectedFiles.size(); ff++) {
|
for (const auto &fileName : selectedFiles) {
|
||||||
const wxString &fileName = selectedFiles[ff];
|
|
||||||
|
|
||||||
// Make sure it isn't already open.
|
// Make sure it isn't already open.
|
||||||
if (ProjectFileManager::IsAlreadyOpen(fileName))
|
if (ProjectFileManager::IsAlreadyOpen(fileName))
|
||||||
continue; // Skip ones that are already open.
|
continue; // Skip ones that are already open.
|
||||||
|
@ -59,6 +59,7 @@ bool OpenProjectCommand::Apply(const CommandContext & context){
|
|||||||
auto oldFileName = projectFileIO.GetFileName();
|
auto oldFileName = projectFileIO.GetFileName();
|
||||||
if(mFileName.empty())
|
if(mFileName.empty())
|
||||||
{
|
{
|
||||||
|
// This path queries the user for files to open
|
||||||
auto project = &context.project;
|
auto project = &context.project;
|
||||||
ProjectManager::OpenFiles(project);
|
ProjectManager::OpenFiles(project);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user