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

Unified Diff: views/controls/menu/menu_config_win.cc

Issue 7978021: Fix memory leak on menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use ScopedHFONT Created 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/menu/menu_config_win.cc
diff --git a/views/controls/menu/menu_config_win.cc b/views/controls/menu/menu_config_win.cc
index 8ddbdb0fe98e0cc794d601beee454e26fadf8002..869d13121a09b9d2091dd9063437afa4616cd5d6 100644
--- a/views/controls/menu/menu_config_win.cc
+++ b/views/controls/menu/menu_config_win.cc
@@ -9,6 +9,7 @@
#include <Vssym32.h>
#include "base/logging.h"
+#include "base/win/scoped_gdi_object.h"
#include "base/win/win_util.h"
#include "ui/base/l10n/l10n_util_win.h"
#include "ui/gfx/native_theme_win.h"
@@ -29,10 +30,11 @@ MenuConfig* MenuConfig::Create() {
NONCLIENTMETRICS metrics;
base::win::GetNonClientMetrics(&metrics);
l10n_util::AdjustUIFont(&(metrics.lfMenuFont));
- HFONT font = CreateFontIndirect(&metrics.lfMenuFont);
- DLOG_ASSERT(font);
- config->font = gfx::Font(font);
-
+ {
+ base::win::ScopedHFONT font(CreateFontIndirect(&metrics.lfMenuFont));
+ DLOG_ASSERT(font.Get());
+ config->font = gfx::Font(font);
+ }
NativeTheme::ExtraParams extra;
extra.menu_check.is_radio = false;
extra.menu_check.is_selected = false;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698