From 682adeb3aa6a3d38b245b94e821cecfa75a1c2a5 Mon Sep 17 00:00:00 2001 From: Murai Takashi Date: Sat, 24 Dec 2016 06:19:18 +0900 Subject: [PATCH] IconButton.cpp: fix memory leak. Signed-off-by: Adrien Destugues Ticket : #13127 --- src/kits/shared/IconButton.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/kits/shared/IconButton.cpp b/src/kits/shared/IconButton.cpp index 0000f1d757..bcfb58a4f7 100644 --- a/src/kits/shared/IconButton.cpp +++ b/src/kits/shared/IconButton.cpp @@ -448,9 +448,9 @@ BIconButton::SetIcon(const unsigned char* bitsFromQuickRes, BBitmap* bitmap = new(std::nothrow) BBitmap( quickResBitmap->Bounds(), B_RGB32, true); if (bitmap && bitmap->IsValid()) { - BView* helper = new BView(bitmap->Bounds(), "helper", - B_FOLLOW_NONE, B_WILL_DRAW); if (bitmap->Lock()) { + BView* helper = new BView(bitmap->Bounds(), "helper", + B_FOLLOW_NONE, B_WILL_DRAW); bitmap->AddChild(helper); helper->SetHighColor(ui_color(B_PANEL_BACKGROUND_COLOR)); helper->FillRect(helper->Bounds()); @@ -664,9 +664,9 @@ BIconButton::_ConvertToRGB32(const BBitmap* bitmap) const B_BITMAP_ACCEPTS_VIEWS, B_RGBA32); if (convertedBitmap && convertedBitmap->IsValid()) { memset(convertedBitmap->Bits(), 0, convertedBitmap->BitsLength()); - BView* helper = new BView(bitmap->Bounds(), "helper", - B_FOLLOW_NONE, B_WILL_DRAW); if (convertedBitmap->Lock()) { + BView* helper = new BView(bitmap->Bounds(), "helper", + B_FOLLOW_NONE, B_WILL_DRAW); convertedBitmap->AddChild(helper); helper->SetDrawingMode(B_OP_OVER); helper->DrawBitmap(bitmap, BPoint(0.0, 0.0));