Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1053)

Unified Diff: printing/emf_win.cc

Issue 1406403007: Eliminate HICON leaks caused by creating icons from bitmap image. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use ScopedGeneric to define ScopedGDIObject. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: printing/emf_win.cc
diff --git a/printing/emf_win.cc b/printing/emf_win.cc
index d5e1888fe7cf42607ea3d1646892d0333cbce74a..521b85d3e123f88cf53afe96fd9fd5a486c3f522 100644
--- a/printing/emf_win.cc
+++ b/printing/emf_win.cc
@@ -104,12 +104,12 @@ class RasterBitmap {
gfx::Rect bitmap_rect(raster_size);
gfx::CreateBitmapHeader(raster_size.width(), raster_size.height(),
&header_.bmiHeader);
- bitmap_.Set(::CreateDIBSection(context_.Get(), &header_, DIB_RGB_COLORS,
+ bitmap_.reset(CreateDIBSection(context_.Get(), &header_, DIB_RGB_COLORS,
&bits, NULL, 0));
- if (!bitmap_)
+ if (!bitmap_.is_valid())
NOTREACHED() << "Raster bitmap creation for printing failed";
- saved_object_ = ::SelectObject(context_.Get(), bitmap_);
+ saved_object_ = ::SelectObject(context_.Get(), bitmap_.get());
RECT rect = bitmap_rect.ToRECT();
::FillRect(context_.Get(), &rect,
static_cast<HBRUSH>(::GetStockObject(WHITE_BRUSH)));

Powered by Google App Engine
This is Rietveld 408576698