1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-03-05 22:21:15 +01:00

Sizers are owned by wxWindow objects when added, so use safenew, or...

... use unique_ptr in the interim between building them and adding.

This checks eliminates some naked news, which were not paired with deletes.
This commit is contained in:
Paul Licameli
2016-02-18 14:53:43 -05:00
parent c7d3ff7299
commit 1c07741d57
26 changed files with 1338 additions and 1233 deletions

View File

@@ -109,28 +109,33 @@ ErrorDialog::ErrorDialog(
#if 0
// Original non ShuttleGui based code.
// Layout did not look good on Windows.
wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *vSizer = new wxBoxSizer(wxVERTICAL);
wxBoxSizer mainSizer;
{
auto uMainSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
mainSizer = uMainSizer.get();
auto vSizer = make_unique<xBoxSizer>(wxVERTICAL);
wxBoxSizer *hSizer = new wxBoxSizer(wxHORIZONTAL);
auto hSizer = make_unique<wxBoxSizer>(wxHORIZONTAL);
wxStaticText *statText = safenew wxStaticText(this, -1, message);
mainSizer->Add(statText, 0, wxALIGN_LEFT|wxALL, 5);
wxStaticText *statText = safenew wxStaticText(this, -1, message);
mainSizer->Add(statText, 0, wxALIGN_LEFT|wxALL, 5);
wxButton *help = safenew wxButton(this, wxID_HELP, _("Help"));
hSizer->Add(help, 0, wxALIGN_LEFT|wxALL, 5);
wxButton *help = safenew wxButton(this, wxID_HELP, _("Help"));
hSizer->Add(help, 0, wxALIGN_LEFT|wxALL, 5);
wxButton *ok = safenew wxButton(this, wxID_OK, _("OK"));
ok->SetDefault();
ok->SetFocus();
hSizer->Add(ok, 0, wxALIGN_RIGHT|wxALL, 5);
wxButton *ok = safenew wxButton(this, wxID_OK, _("OK"));
ok->SetDefault();
ok->SetFocus();
hSizer->Add(ok, 0, wxALIGN_RIGHT|wxALL, 5);
vSizer->Add(hSizer, 0, wxALIGN_CENTER|wxALL, 5);
vSizer->Add(hSizer.release(), 0, wxALIGN_CENTER|wxALL, 5);
mainSizer->Add(vSizer, 0, wxALL, 15 );
mainSizer->Add(vSizer.release(), 0, wxALL, 15 );
SetAutoLayout(true);
SetSizer(uMainSizer.release());
}
SetAutoLayout(true);
SetSizer(mainSizer);
mainSizer->Fit(this);
mainSizer->SetSizeHints(this);
#endif