1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-25 08:38:39 +02:00

Fix crash initializing GlobalPrefsDialog for special case of undefined temp...

... directory at startup time.
This commit is contained in:
Paul Licameli 2015-06-17 16:01:44 -04:00
parent 7b01339e51
commit b924c8ad62
3 changed files with 9 additions and 11 deletions

View File

@ -92,6 +92,7 @@ It handles initialization and termination by subclassing wxApp.
#include "ondemand/ODManager.h"
#include "commands/Keyboard.h"
#include "widgets/ErrorDialog.h"
#include "prefs/DirectoriesPrefs.h"
//temporarilly commented out till it is added to all projects
//#include "Profiler.h"
@ -1605,8 +1606,11 @@ bool AudacityApp::InitTempDir()
// Failed
wxMessageBox(_("Audacity could not find a place to store temporary files.\nPlease enter an appropriate directory in the preferences dialog."));
GlobalPrefsDialog dialog(NULL);
dialog.ShowTempDirPage();
// Only want one page of the preferences
DirectoriesPrefsFactory directoriesPrefsFactory;
PrefsDialog::Factories factories;
factories.push_back(&directoriesPrefsFactory);
GlobalPrefsDialog dialog(NULL, factories);
dialog.ShowModal();
wxMessageBox(_("Audacity is now going to exit. Please launch Audacity again to use the new temporary directory."));

View File

@ -386,18 +386,13 @@ void PrefsDialog::SelectPageByName(wxString pageName)
}
}
void PrefsDialog::ShowTempDirPage()
{
SelectPageByName(_("Directories"));
}
int PrefsDialog::GetSelectedPage() const
{
return mCategories->GetSelection();
}
GlobalPrefsDialog::GlobalPrefsDialog(wxWindow * parent)
: PrefsDialog(parent, _("Preferences: "), DefaultFactories())
GlobalPrefsDialog::GlobalPrefsDialog(wxWindow * parent, Factories &factories)
: PrefsDialog(parent, _("Preferences: "), factories)
{
}

View File

@ -58,7 +58,6 @@ class PrefsDialog:public wxDialog
void OnTreeKeyDown(wxTreeEvent & e); // Used to dismiss the dialog when enter is pressed with focus on tree
void SelectPageByName(wxString pageName);
void ShowTempDirPage();
// Accessor to help implementations of SavePreferredPage(),
// such as by saving a preference after DoModal() returns
@ -85,7 +84,7 @@ private:
class GlobalPrefsDialog : public PrefsDialog
{
public:
GlobalPrefsDialog(wxWindow * parent);
GlobalPrefsDialog(wxWindow * parent, Factories &factories = DefaultFactories());
virtual ~GlobalPrefsDialog();
virtual long GetPreferredPage();
virtual void SavePreferredPage();