1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-25 15:53:52 +02:00

Use macro safenew for many allocations of wxWindow subclasses

This commit is contained in:
Paul Licameli
2016-02-13 18:06:49 -05:00
parent 6052b5f9be
commit 3f237daddc
42 changed files with 238 additions and 214 deletions

View File

@@ -225,7 +225,8 @@ bool ExportPlugin::DisplayOptions(wxWindow * WXUNUSED(parent), int WXUNUSED(form
wxWindow *ExportPlugin::OptionsCreate(wxWindow *parent, int WXUNUSED(format))
{
wxPanel *p = new wxPanel(parent, wxID_ANY);
wxASSERT(parent); // To justify safenew
wxPanel *p = safenew wxPanel(parent, wxID_ANY);
ShuttleGui S(p, eIsCreatingFromPrefs);
S.StartHorizontalLay(wxCENTER);
@@ -881,7 +882,7 @@ void Exporter::CreateUserPane(wxWindow *parent)
{
S.StartStatic(_("Format Options"), 1);
{
mBook = new wxSimplebook(parent);
mBook = safenew wxSimplebook(S.GetParent());
S.AddWindow(mBook, wxEXPAND);
for (size_t i = 0; i < mPlugins.GetCount(); i++)
@@ -1224,10 +1225,10 @@ ExportMixerDialog::ExportMixerDialog( TrackList *tracks, bool selectedOnly,
wxString label;
label.Printf( _( "Output Channels: %2d" ), mMixerSpec->GetNumChannels() );
mChannelsText = new wxStaticText( this, -1, label);
mChannelsText = safenew wxStaticText(this, -1, label);
horSizer->Add( mChannelsText, 0, wxALIGN_LEFT | wxALL, 5 );
wxSlider *channels = new wxSlider( this, ID_SLIDER_CHANNEL,
wxSlider *channels = safenew wxSlider( this, ID_SLIDER_CHANNEL,
mMixerSpec->GetNumChannels(), 1, mMixerSpec->GetMaxNumChannels(),
wxDefaultPosition, wxSize( 300, -1 ) );
channels->SetName(label);

View File

@@ -270,7 +270,7 @@ void ExportMultiple::PopulateOrExchange(ShuttleGui& S)
S.AddPrompt(_("Options:"));
if (!mBook)
{
mBook = new wxSimplebook(S.GetParent(), OptionsID, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC);
mBook = safenew wxSimplebook(S.GetParent(), OptionsID, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC);
for (size_t i = 0; i < mPlugins.GetCount(); i++)
{
for (int j = 0; j < mPlugins[i]->GetFormatCount(); j++)