diff options
author | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-08 05:22:10 +0000 |
---|---|---|
committer | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-08 05:22:10 +0000 |
commit | 8deb1ff3e5d8eb99422207d691bf099b9f92b349 (patch) | |
tree | ff9d3eb3b48972b144fe6cd0b78b85926a9819d7 /views | |
parent | d0691ffc36d299c0a4e73c876121a97360e7f77b (diff) | |
download | chromium_src-8deb1ff3e5d8eb99422207d691bf099b9f92b349.zip chromium_src-8deb1ff3e5d8eb99422207d691bf099b9f92b349.tar.gz chromium_src-8deb1ff3e5d8eb99422207d691bf099b9f92b349.tar.bz2 |
Fix memory leak in ImageButton exposed by r20028.
BUG= none.
TEST= none.
Review URL: http://codereview.chromium.org/149313
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20134 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/button/image_button.cc | 10 | ||||
-rw-r--r-- | views/controls/button/image_button.h | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/views/controls/button/image_button.cc b/views/controls/button/image_button.cc index 85f5f4e..29f1fe8 100644 --- a/views/controls/button/image_button.cc +++ b/views/controls/button/image_button.cc @@ -38,10 +38,10 @@ void ImageButton::SetBackground(SkColor color, SkBitmap* image, SkBitmap* mask) { if (!color && !image) - background_image_ = NULL; + background_image_.reset(NULL); - background_image_ = new SkBitmap( - skia::ImageOperations::CreateButtonBackground(color, *image, *mask)); + background_image_.reset(new SkBitmap( + skia::ImageOperations::CreateButtonBackground(color, *image, *mask))); } void ImageButton::SetImageAlignment(HorizontalAlignment h_align, @@ -79,8 +79,8 @@ void ImageButton::Paint(gfx::Canvas* canvas) { else if (v_alignment_ == ALIGN_BOTTOM) y = height() - img.height(); - if (background_image_) - canvas->DrawBitmapInt(*background_image_, x, y); + if (background_image_.get()) + canvas->DrawBitmapInt(*(background_image_.get()), x, y); canvas->DrawBitmapInt(img, x, y); } PaintFocusBorder(canvas); diff --git a/views/controls/button/image_button.h b/views/controls/button/image_button.h index c3edceb..f31e3ce 100644 --- a/views/controls/button/image_button.h +++ b/views/controls/button/image_button.h @@ -47,7 +47,7 @@ class ImageButton : public CustomButton { SkBitmap images_[BS_COUNT]; // The background image. - SkBitmap* background_image_; + scoped_ptr<SkBitmap> background_image_; private: // Image alignment. |