From 3bc6c5b396bb6972ad2892237fc5d73fe8a9c42e Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 5 Jun 2013 14:28:27 +0100 Subject: Hopefully fix crash on startup on Windows. --- src/wx/new_film_dialog.cc | 9 +++++++-- src/wx/new_film_dialog.h | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/wx/new_film_dialog.cc b/src/wx/new_film_dialog.cc index 737b07fbb..191482a7c 100644 --- a/src/wx/new_film_dialog.cc +++ b/src/wx/new_film_dialog.cc @@ -29,7 +29,7 @@ using namespace std; using namespace boost; -string NewFilmDialog::_directory = Config::instance()->default_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir())); +boost::optional NewFilmDialog::_directory; NewFilmDialog::NewFilmDialog (wxWindow* parent) : wxDialog (parent, wxID_ANY, _("New Film")) @@ -51,7 +51,12 @@ NewFilmDialog::NewFilmDialog (wxWindow* parent) #else _folder = new wxDirPickerCtrl (this, wxDD_DIR_MUST_EXIST); #endif - _folder->SetPath (std_to_wx (_directory)); + + if (!_directory) { + _directory = Config::instance()->default_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir())); + } + + _folder->SetPath (std_to_wx (_directory.get())); table->Add (_folder, 1, wxEXPAND); wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL); diff --git a/src/wx/new_film_dialog.h b/src/wx/new_film_dialog.h index 715f71f51..bfcbd423c 100644 --- a/src/wx/new_film_dialog.h +++ b/src/wx/new_film_dialog.h @@ -37,5 +37,5 @@ private: #else wxDirPickerCtrl* _folder; #endif - static std::string _directory; + static boost::optional _directory; }; -- cgit v1.2.3