Ticket #13127: 0039-IconButton.cpp-fix-memory-leak.patch

File 0039-IconButton.cpp-fix-memory-leak.patch, 1.6 KB (added by mt, 7 years ago)
  • src/kits/shared/IconButton.cpp

    From baa57d6dd854e8fc18a8a6bada3b7a763c6beeb3 Mon Sep 17 00:00:00 2001
    From: Murai Takashi <tmurai01@gmail.com>
    Date: Sat, 24 Dec 2016 06:19:18 +0900
    Subject: [PATCH 39/39] IconButton.cpp: fix memory leak.
    
    ---
     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 0000f1d..bcfb58a 100644
    a b BIconButton::SetIcon(const unsigned char* bitsFromQuickRes,  
    448448                BBitmap* bitmap = new(std::nothrow) BBitmap(
    449449                    quickResBitmap->Bounds(), B_RGB32, true);
    450450                if (bitmap && bitmap->IsValid()) {
    451                     BView* helper = new BView(bitmap->Bounds(), "helper",
    452                         B_FOLLOW_NONE, B_WILL_DRAW);
    453451                    if (bitmap->Lock()) {
     452                        BView* helper = new BView(bitmap->Bounds(), "helper",
     453                            B_FOLLOW_NONE, B_WILL_DRAW);
    454454                        bitmap->AddChild(helper);
    455455                        helper->SetHighColor(ui_color(B_PANEL_BACKGROUND_COLOR));
    456456                        helper->FillRect(helper->Bounds());
    BIconButton::_ConvertToRGB32(const BBitmap* bitmap) const  
    664664        B_BITMAP_ACCEPTS_VIEWS, B_RGBA32);
    665665    if (convertedBitmap && convertedBitmap->IsValid()) {
    666666        memset(convertedBitmap->Bits(), 0, convertedBitmap->BitsLength());
    667         BView* helper = new BView(bitmap->Bounds(), "helper",
    668                                   B_FOLLOW_NONE, B_WILL_DRAW);
    669667        if (convertedBitmap->Lock()) {
     668            BView* helper = new BView(bitmap->Bounds(), "helper",
     669                B_FOLLOW_NONE, B_WILL_DRAW);
    670670            convertedBitmap->AddChild(helper);
    671671            helper->SetDrawingMode(B_OP_OVER);
    672672            helper->DrawBitmap(bitmap, BPoint(0.0, 0.0));