mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-04 09:39:42 +02:00
Fewer naked news and deletes in Tags.cpp and LabelDialog.cpp
This commit is contained in:
parent
c87eb0804b
commit
42fcfdab98
@ -121,7 +121,7 @@ LabelDialog::LabelDialog(wxWindow *parent,
|
||||
5);
|
||||
|
||||
// Create the main sizer
|
||||
mGrid = new Grid(this, wxID_ANY);
|
||||
mGrid = safenew Grid(this, wxID_ANY);
|
||||
vs->Add(mGrid, 1, wxEXPAND | wxALL, 5);
|
||||
|
||||
// Create the action buttons
|
||||
@ -162,20 +162,18 @@ LabelDialog::LabelDialog(wxWindow *parent,
|
||||
mTimeEditor = (TimeEditor *) mGrid->GetDefaultEditorForType(GRID_VALUE_TIME);
|
||||
|
||||
// Initialize and set the track name column attributes
|
||||
wxGridCellAttr *attr = new wxGridCellAttr();
|
||||
wxGridCellAttr *attr;
|
||||
mGrid->SetColAttr(Col_Track, (attr = safenew wxGridCellAttr));
|
||||
attr->SetEditor(mChoiceEditor);
|
||||
mGrid->SetColAttr(Col_Track, attr);
|
||||
mTrackNames.Add(_("New..."));
|
||||
|
||||
// Initialize and set the time column attributes
|
||||
attr = new wxGridCellAttr();
|
||||
|
||||
mGrid->SetColAttr(Col_Stime, (attr = safenew wxGridCellAttr));
|
||||
// Don't need DecRef() after this GetDefaultRendererForType.
|
||||
attr->SetRenderer(mGrid->GetDefaultRendererForType(GRID_VALUE_TIME));
|
||||
|
||||
attr->SetEditor(mTimeEditor);
|
||||
attr->SetAlignment(wxALIGN_CENTER, wxALIGN_CENTER);
|
||||
mGrid->SetColAttr(Col_Stime, attr);
|
||||
|
||||
mGrid->SetColAttr(Col_Etime, attr->Clone());
|
||||
|
||||
// Seems there's a bug in wxGrid. Adding only 1 row does not
|
||||
|
16
src/Tags.cpp
16
src/Tags.cpp
@ -715,12 +715,15 @@ TagsEditor::TagsEditor(wxWindow * parent,
|
||||
|
||||
TagsEditor::~TagsEditor()
|
||||
{
|
||||
delete mGrid;
|
||||
// This DELETE is not needed because wxWidgets owns the grid.
|
||||
// DELETE mGrid;
|
||||
|
||||
// TODO: Need to figure out if these should be deleted. Looks like the wxGrid
|
||||
// code takes ownership and uses reference counting, but there's been
|
||||
// cases where they show up as memory leaks.
|
||||
// delete mStringRenderer;
|
||||
// delete mComboEditor;
|
||||
// PRL: Fixed the leaks, see commit c87eb0804bc5f40659b133cab6e2ade061959645
|
||||
// DELETE mStringRenderer;
|
||||
// DELETE mComboEditor;
|
||||
}
|
||||
|
||||
void TagsEditor::PopulateOrExchange(ShuttleGui & S)
|
||||
@ -740,10 +743,9 @@ void TagsEditor::PopulateOrExchange(ShuttleGui & S)
|
||||
wxDefaultSize,
|
||||
wxSUNKEN_BORDER);
|
||||
|
||||
mStringRenderer = new wxGridCellStringRenderer;
|
||||
mComboEditor = new ComboEditor(wxArrayString(), true);
|
||||
|
||||
mGrid->RegisterDataType(wxT("Combo"), mStringRenderer, mComboEditor);
|
||||
mGrid->RegisterDataType(wxT("Combo"),
|
||||
(mStringRenderer = safenew wxGridCellStringRenderer),
|
||||
(mComboEditor = safenew ComboEditor(wxArrayString(), true)));
|
||||
|
||||
mGrid->SetColLabelSize(mGrid->GetDefaultRowSize());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user