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);
|
5);
|
||||||
|
|
||||||
// Create the main sizer
|
// Create the main sizer
|
||||||
mGrid = new Grid(this, wxID_ANY);
|
mGrid = safenew Grid(this, wxID_ANY);
|
||||||
vs->Add(mGrid, 1, wxEXPAND | wxALL, 5);
|
vs->Add(mGrid, 1, wxEXPAND | wxALL, 5);
|
||||||
|
|
||||||
// Create the action buttons
|
// Create the action buttons
|
||||||
|
@ -162,20 +162,18 @@ LabelDialog::LabelDialog(wxWindow *parent,
|
||||||
mTimeEditor = (TimeEditor *) mGrid->GetDefaultEditorForType(GRID_VALUE_TIME);
|
mTimeEditor = (TimeEditor *) mGrid->GetDefaultEditorForType(GRID_VALUE_TIME);
|
||||||
|
|
||||||
// Initialize and set the track name column attributes
|
// Initialize and set the track name column attributes
|
||||||
wxGridCellAttr *attr = new wxGridCellAttr();
|
wxGridCellAttr *attr;
|
||||||
|
mGrid->SetColAttr(Col_Track, (attr = safenew wxGridCellAttr));
|
||||||
attr->SetEditor(mChoiceEditor);
|
attr->SetEditor(mChoiceEditor);
|
||||||
mGrid->SetColAttr(Col_Track, attr);
|
|
||||||
mTrackNames.Add(_("New..."));
|
mTrackNames.Add(_("New..."));
|
||||||
|
|
||||||
// Initialize and set the time column attributes
|
// Initialize and set the time column attributes
|
||||||
attr = new wxGridCellAttr();
|
mGrid->SetColAttr(Col_Stime, (attr = safenew wxGridCellAttr));
|
||||||
|
|
||||||
// Don't need DecRef() after this GetDefaultRendererForType.
|
// Don't need DecRef() after this GetDefaultRendererForType.
|
||||||
attr->SetRenderer(mGrid->GetDefaultRendererForType(GRID_VALUE_TIME));
|
attr->SetRenderer(mGrid->GetDefaultRendererForType(GRID_VALUE_TIME));
|
||||||
|
|
||||||
attr->SetEditor(mTimeEditor);
|
attr->SetEditor(mTimeEditor);
|
||||||
attr->SetAlignment(wxALIGN_CENTER, wxALIGN_CENTER);
|
attr->SetAlignment(wxALIGN_CENTER, wxALIGN_CENTER);
|
||||||
mGrid->SetColAttr(Col_Stime, attr);
|
|
||||||
mGrid->SetColAttr(Col_Etime, attr->Clone());
|
mGrid->SetColAttr(Col_Etime, attr->Clone());
|
||||||
|
|
||||||
// Seems there's a bug in wxGrid. Adding only 1 row does not
|
// 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()
|
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
|
// 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
|
// code takes ownership and uses reference counting, but there's been
|
||||||
// cases where they show up as memory leaks.
|
// cases where they show up as memory leaks.
|
||||||
// delete mStringRenderer;
|
// PRL: Fixed the leaks, see commit c87eb0804bc5f40659b133cab6e2ade061959645
|
||||||
// delete mComboEditor;
|
// DELETE mStringRenderer;
|
||||||
|
// DELETE mComboEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TagsEditor::PopulateOrExchange(ShuttleGui & S)
|
void TagsEditor::PopulateOrExchange(ShuttleGui & S)
|
||||||
|
@ -740,10 +743,9 @@ void TagsEditor::PopulateOrExchange(ShuttleGui & S)
|
||||||
wxDefaultSize,
|
wxDefaultSize,
|
||||||
wxSUNKEN_BORDER);
|
wxSUNKEN_BORDER);
|
||||||
|
|
||||||
mStringRenderer = new wxGridCellStringRenderer;
|
mGrid->RegisterDataType(wxT("Combo"),
|
||||||
mComboEditor = new ComboEditor(wxArrayString(), true);
|
(mStringRenderer = safenew wxGridCellStringRenderer),
|
||||||
|
(mComboEditor = safenew ComboEditor(wxArrayString(), true)));
|
||||||
mGrid->RegisterDataType(wxT("Combo"), mStringRenderer, mComboEditor);
|
|
||||||
|
|
||||||
mGrid->SetColLabelSize(mGrid->GetDefaultRowSize());
|
mGrid->SetColLabelSize(mGrid->GetDefaultRowSize());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user