Commit 83518612 authored by mirandac@chromium.org's avatar mirandac@chromium.org

Fix memory leaks introduced and exposed by r20028.

BUG= none
TEST= none


Review URL: http://codereview.chromium.org/155195

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20129 0039d316-1c4b-4281-b951-d872f2087c98
parent abd642c1
...@@ -1102,8 +1102,11 @@ void TabStrip::LoadNewTabButtonImage() { ...@@ -1102,8 +1102,11 @@ void TabStrip::LoadNewTabButtonImage() {
// If we don't have a theme provider yet, it means we do not have a // If we don't have a theme provider yet, it means we do not have a
// root view, and are therefore in a test. // root view, and are therefore in a test.
if (tp == NULL) bool in_test = false;
if (tp == NULL) {
tp = new views::DefaultThemeProvider(); tp = new views::DefaultThemeProvider();
in_test = true;
}
SkBitmap* bitmap = tp->GetBitmapNamed(IDR_NEWTAB_BUTTON); SkBitmap* bitmap = tp->GetBitmapNamed(IDR_NEWTAB_BUTTON);
SkColor color = tp->GetColor(BrowserThemeProvider::COLOR_BUTTON_BACKGROUND); SkColor color = tp->GetColor(BrowserThemeProvider::COLOR_BUTTON_BACKGROUND);
...@@ -1117,6 +1120,8 @@ void TabStrip::LoadNewTabButtonImage() { ...@@ -1117,6 +1120,8 @@ void TabStrip::LoadNewTabButtonImage() {
tp->GetBitmapNamed(IDR_NEWTAB_BUTTON_H)); tp->GetBitmapNamed(IDR_NEWTAB_BUTTON_H));
newtab_button_->SetBackground(color, background, newtab_button_->SetBackground(color, background,
tp->GetBitmapNamed(IDR_NEWTAB_BUTTON_MASK)); tp->GetBitmapNamed(IDR_NEWTAB_BUTTON_MASK));
if (in_test)
delete tp;
} }
Tab* TabStrip::GetTabAt(int index) const { Tab* TabStrip::GetTabAt(int index) const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment