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

Unified Diff: ui/native_theme/native_theme_win.cc

Issue 2365903002: Fix GDI leak in NativeThemeWin::PaintIndirect (Closed)
Patch Set: Created 4 years, 3 months 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
« skia/ext/skia_utils_win.cc ('K') | « skia/ext/skia_utils_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/native_theme/native_theme_win.cc
diff --git a/ui/native_theme/native_theme_win.cc b/ui/native_theme/native_theme_win.cc
index 043a3d47278a278e01d1c455157a9ae06ceec4b9..684ff3010ca561c09df6093bbd87b914d873e6ae 100644
--- a/ui/native_theme/native_theme_win.cc
+++ b/ui/native_theme/native_theme_win.cc
@@ -664,9 +664,11 @@ void NativeThemeWin::PaintIndirect(SkCanvas* destination_canvas,
// be sped up by doing it only once per part/state and
// keeping a cache of the resulting bitmaps.
+ // Bitmap needs to be deleted together with DC (before or after).
Peter Kasting 2016/09/23 18:45:00 According to docs I found on the web, an attempt t
+ base::win::ScopedBitmap bitmap;
// Create an offscreen canvas that is backed by an HDC.
base::win::ScopedCreateDC offscreen_hdc(
- skia::CreateOffscreenSurface(rect.width(), rect.height()));
+ skia::CreateOffscreenSurface(&bitmap, rect.width(), rect.height()));
sk_sp<SkSurface> offscreen_surface =
skia::MapPlatformSurface(offscreen_hdc.Get());
DCHECK(offscreen_surface);
« skia/ext/skia_utils_win.cc ('K') | « skia/ext/skia_utils_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698