More stack-allocated Dialog objects.
[dcpomatic.git] / src / wx / file_picker_ctrl.cc
index 284f7bc99336d93dd9ad80a5c6fbc3e4c181d04c..bf4877891a2344860c862f8d77599118e4341842 100644 (file)
@@ -83,12 +83,11 @@ FilePickerCtrl::browse_clicked ()
        if (_warn_overwrite) {
                style |= wxFD_OVERWRITE_PROMPT;
        }
-       wxFileDialog* d = new wxFileDialog (this, _prompt, wxEmptyString, wxEmptyString, _wildcard, style);
-       d->SetPath (_path);
-       if (d->ShowModal () == wxID_OK) {
-               SetPath (d->GetPath ());
+       wxFileDialog dialog(this, _prompt, wxEmptyString, wxEmptyString, _wildcard, style);
+       dialog.SetPath(_path);
+       if (dialog.ShowModal() == wxID_OK) {
+               SetPath(dialog.GetPath());
        }
-       d->Destroy ();
 }
 
 void