1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-03-12 17:35:33 +01:00

Review uses of safenew...

... add comments and assertions, and use make_unique instead where possible
This commit is contained in:
Paul Licameli
2016-08-13 23:16:05 -04:00
parent 84a6456788
commit 32f24eabb2
13 changed files with 24 additions and 6 deletions

View File

@@ -14,7 +14,7 @@ BackedPanel::BackedPanel(wxWindow * parent, wxWindowID id,
const wxSize & size,
long style)
: wxPanelWrapper(parent, id, pos, size, style)
, mBacking{ safenew wxBitmap(1, 1) }
, mBacking{ std::make_unique<wxBitmap>(1, 1) }
{
// Preinit the backing DC and bitmap so routines that require it will
// not cause a crash if they run before the panel is fully initialized.
@@ -52,7 +52,7 @@ void BackedPanel::ResizeBacking()
mBackingDC.SelectObject(wxNullBitmap);
wxSize sz = GetClientSize();
mBacking.reset(safenew wxBitmap);
mBacking = std::make_unique<wxBitmap>();
mBacking->Create(sz.x, sz.y); //, *dc);
mBackingDC.SelectObject(*mBacking);
}