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

Unified Diff: views/widget/native_widget_win.cc

Issue 7806010: Fix small memory leak on SysAllocString. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Use IAccPropServices::SetHwndPropStr Created 9 years, 4 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/widget/native_widget_win.cc
diff --git a/views/widget/native_widget_win.cc b/views/widget/native_widget_win.cc
index 2701173b5c6ef64b69a01748a44ea03c91cc1f1f..45f341e7d2de7639f1495a6767fb4b700fea8b87 100644
--- a/views/widget/native_widget_win.cc
+++ b/views/widget/native_widget_win.cc
@@ -7,6 +7,8 @@
#include <dwmapi.h>
#include <shellapi.h>
+#include <algorithm>
+
#include "base/string_util.h"
#include "base/system_monitor/system_monitor.h"
#include "base/win/scoped_gdi_object.h"
@@ -691,13 +693,10 @@ void NativeWidgetWin::SetAccessibleName(const std::wstring& name) {
base::win::ScopedComPtr<IAccPropServices> pAccPropServices;
HRESULT hr = CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER,
IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices));
- if (SUCCEEDED(hr)) {
- VARIANT var;
- var.vt = VT_BSTR;
- var.bstrVal = SysAllocString(name.c_str());
- hr = pAccPropServices->SetHwndProp(GetNativeView(), OBJID_CLIENT,
- CHILDID_SELF, PROPID_ACC_NAME, var);
- }
+ if (SUCCEEDED(hr))
+ hr = pAccPropServices->SetHwndPropStr(GetNativeView(), OBJID_CLIENT,
+ CHILDID_SELF, PROPID_ACC_NAME,
+ name.c_str());
}
void NativeWidgetWin::SetAccessibleRole(ui::AccessibilityTypes::Role role) {
@@ -722,6 +721,7 @@ void NativeWidgetWin::SetAccessibleState(ui::AccessibilityTypes::State state) {
if (SUCCEEDED(hr)) {
VARIANT var;
if (state) {
+ var.vt = VT_I4;
var.lVal = NativeViewAccessibilityWin::MSAAState(state);
hr = pAccPropServices->SetHwndProp(GetNativeView(), OBJID_CLIENT,
CHILDID_SELF, PROPID_ACC_STATE, var);
@@ -1061,7 +1061,7 @@ void NativeWidgetWin::SchedulePaintInRect(const gfx::Rect& rect) {
}
void NativeWidgetWin::SetCursor(gfx::NativeCursor cursor) {
- if(cursor) {
+ if (cursor) {
previous_cursor_ = ::SetCursor(cursor);
} else if (previous_cursor_) {
::SetCursor(previous_cursor_);
@@ -1609,7 +1609,7 @@ LRESULT NativeWidgetWin::OnNCCalcSize(BOOL mode, LPARAM l_param) {
}
RECT* client_rect = mode ?
- &reinterpret_cast<NCCALCSIZE_PARAMS*>(l_param)->rgrc[0] :
+ &(reinterpret_cast<NCCALCSIZE_PARAMS*>(l_param)->rgrc[0]) :
reinterpret_cast<RECT*>(l_param);
client_rect->left += insets.left();
client_rect->top += insets.top();
« 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