summaryrefslogtreecommitdiffstats
path: root/chrome/browser/icon_loader_win.cc
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-07 18:43:12 +0000
committerrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-07 18:43:12 +0000
commitab6d23fe5463f88e7e48147d10447575296f75f9 (patch)
tree672e2be570be3b2d557e76966f30142ebf9f7c8f /chrome/browser/icon_loader_win.cc
parentde595563f3bc74fc49e072e19d467970e9aff782 (diff)
downloadchromium_src-ab6d23fe5463f88e7e48147d10447575296f75f9.zip
chromium_src-ab6d23fe5463f88e7e48147d10447575296f75f9.tar.gz
chromium_src-ab6d23fe5463f88e7e48147d10447575296f75f9.tar.bz2
In icon_loader_win.cc, if CreateSkBitmapFromHICON fails, don't pass NULL to gfx::Image and crash.
BUG=92982 TEST=none Review URL: https://chromiumcodereview.appspot.com/7753009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155434 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/icon_loader_win.cc')
-rw-r--r--chrome/browser/icon_loader_win.cc24
1 files changed, 15 insertions, 9 deletions
diff --git a/chrome/browser/icon_loader_win.cc b/chrome/browser/icon_loader_win.cc
index 48e565f..8a167ac 100644
--- a/chrome/browser/icon_loader_win.cc
+++ b/chrome/browser/icon_loader_win.cc
@@ -30,18 +30,24 @@ void IconLoader::ReadIcon() {
default:
NOTREACHED();
}
+
+ image_.reset();
+
SHFILEINFO file_info = { 0 };
- if (!SHGetFileInfo(group_.c_str(), FILE_ATTRIBUTE_NORMAL, &file_info,
+ if (SHGetFileInfo(group_.c_str(), FILE_ATTRIBUTE_NORMAL, &file_info,
sizeof(SHFILEINFO),
- SHGFI_ICON | size | SHGFI_USEFILEATTRIBUTES))
- return;
+ SHGFI_ICON | size | SHGFI_USEFILEATTRIBUTES)) {
+ scoped_ptr<SkBitmap> bitmap(IconUtil::CreateSkBitmapFromHICON(
+ file_info.hIcon));
+ if (bitmap.get()) {
+ gfx::ImageSkia image_skia(*bitmap);
+ image_skia.MakeThreadSafe();
+ image_.reset(new gfx::Image(image_skia));
+ DestroyIcon(file_info.hIcon);
+ }
+ }
- scoped_ptr<SkBitmap> bitmap(IconUtil::CreateSkBitmapFromHICON(
- file_info.hIcon));
- gfx::ImageSkia image_skia(*bitmap);
- image_skia.MakeThreadSafe();
- image_.reset(new gfx::Image(image_skia));
- DestroyIcon(file_info.hIcon);
+ // Always notify the delegate, regardless of success.
target_message_loop_->PostTask(FROM_HERE,
base::Bind(&IconLoader::NotifyDelegate, this));
}