Fix crash when loading a film when one is already loaded.
authorCarl Hetherington <cth@carlh.net>
Sun, 4 Nov 2012 15:56:16 +0000 (15:56 +0000)
committerCarl Hetherington <cth@carlh.net>
Sun, 4 Nov 2012 15:56:16 +0000 (15:56 +0000)
src/tools/dvdomatic.cc

index 5d19a142f11548fa776dc9a8c3cc4fea9ea4160a..535e6d74925d058b8fedb8b08ee10229cd079449 100644 (file)
@@ -282,13 +282,14 @@ public:
        {
                wxDirDialog* c = new wxDirDialog (this, wxT ("Select film to open"), wxStandardPaths::Get().GetDocumentsDir(), wxDEFAULT_DIALOG_STYLE | wxDD_DIR_MUST_EXIST);
                int const r = c->ShowModal ();
-               c->Destroy ();
                
                if (r == wxID_OK) {
                        maybe_save_then_delete_film ();
                        film.reset (new Film (wx_to_std (c->GetPath ())));
                        set_film ();
                }
+
+               c->Destroy ();
        }
 
        void file_save (wxCommandEvent &)