Fix memory leaks in wxGrid unit tests
Use smart pointers to ensure that various objects are released, as they have to be.
This commit is contained in:
@@ -899,7 +899,7 @@ TEST_CASE_METHOD(GridTestCase, "Grid::GetNonDefaultAlignment", "[grid]")
|
|||||||
// GetNonDefaultAlignment() is used by several renderers having their own
|
// GetNonDefaultAlignment() is used by several renderers having their own
|
||||||
// preferred alignment, so check that if we don't reset the alignment
|
// preferred alignment, so check that if we don't reset the alignment
|
||||||
// explicitly, it doesn't override the alignment used by default.
|
// explicitly, it doesn't override the alignment used by default.
|
||||||
wxGridCellAttr* attr = NULL;
|
wxGridCellAttrPtr attr;
|
||||||
int hAlign = wxALIGN_RIGHT,
|
int hAlign = wxALIGN_RIGHT,
|
||||||
vAlign = wxALIGN_INVALID;
|
vAlign = wxALIGN_INVALID;
|
||||||
|
|
||||||
@@ -1174,9 +1174,9 @@ TEST_CASE_METHOD(GridTestCase, "Grid::AutoSizeColumn", "[grid]")
|
|||||||
// Hardcoded extra margin for the columns used in grid.cpp.
|
// Hardcoded extra margin for the columns used in grid.cpp.
|
||||||
const int margin = m_grid->FromDIP(10);
|
const int margin = m_grid->FromDIP(10);
|
||||||
|
|
||||||
wxGridCellAttr *attr = m_grid->GetOrCreateCellAttr(0, 0);
|
wxGridCellAttrPtr attr(m_grid->GetOrCreateCellAttr(0, 0));
|
||||||
wxGridCellRenderer *renderer = attr->GetRenderer(m_grid, 0, 0);
|
wxGridCellRendererPtr renderer(attr->GetRenderer(m_grid, 0, 0));
|
||||||
REQUIRE(renderer != NULL);
|
REQUIRE(renderer);
|
||||||
|
|
||||||
wxClientDC dcCell(m_grid->GetGridWindow());
|
wxClientDC dcCell(m_grid->GetGridWindow());
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user