Commit e55564d5 authored by Robert Liao's avatar Robert Liao Committed by Commit Bot

Remove Uses of Microsoft::WRL::ComPtr<T>::GetAddressOf() in...

Remove Uses of Microsoft::WRL::ComPtr<T>::GetAddressOf() in //chrome/services/util_win/util_win_impl.cc

Microsoft::WRL::ComPtr<T>::GetAddressOf() is banned due to the ease
of causing memory leaks.

BUG=914910
TBR=pmonette@chromium.org

Change-Id: Ib7f6b2a03ead757f5b7d3897c2eb788104cc15db
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2040004Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Reviewed-by: default avatarPatrick Monette <pmonette@chromium.org>
Commit-Queue: Robert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738698}
parent cd9bd929
...@@ -105,8 +105,7 @@ bool IsPinnedToTaskbarHelper::ShortcutHasUnpinToTaskbarVerb( ...@@ -105,8 +105,7 @@ bool IsPinnedToTaskbarHelper::ShortcutHasUnpinToTaskbarVerb(
Microsoft::WRL::ComPtr<Folder> folder; Microsoft::WRL::ComPtr<Folder> folder;
hresult = shell_dispatch->NameSpace( hresult = shell_dispatch->NameSpace(
base::win::ScopedVariant(shortcut.DirName().value().c_str()), base::win::ScopedVariant(shortcut.DirName().value().c_str()), &folder);
folder.GetAddressOf());
if (FAILED(hresult) || !folder) { if (FAILED(hresult) || !folder) {
error_occured_ = true; error_occured_ = true;
return false; return false;
...@@ -114,14 +113,14 @@ bool IsPinnedToTaskbarHelper::ShortcutHasUnpinToTaskbarVerb( ...@@ -114,14 +113,14 @@ bool IsPinnedToTaskbarHelper::ShortcutHasUnpinToTaskbarVerb(
Microsoft::WRL::ComPtr<FolderItem> item; Microsoft::WRL::ComPtr<FolderItem> item;
hresult = folder->ParseName( hresult = folder->ParseName(
base::win::ScopedBstr(shortcut.BaseName().value()), item.GetAddressOf()); base::win::ScopedBstr(shortcut.BaseName().value()), &item);
if (FAILED(hresult) || !item) { if (FAILED(hresult) || !item) {
error_occured_ = true; error_occured_ = true;
return false; return false;
} }
Microsoft::WRL::ComPtr<FolderItemVerbs> verbs; Microsoft::WRL::ComPtr<FolderItemVerbs> verbs;
hresult = item->Verbs(verbs.GetAddressOf()); hresult = item->Verbs(&verbs);
if (FAILED(hresult) || !verbs) { if (FAILED(hresult) || !verbs) {
error_occured_ = true; error_occured_ = true;
return false; return false;
...@@ -137,8 +136,7 @@ bool IsPinnedToTaskbarHelper::ShortcutHasUnpinToTaskbarVerb( ...@@ -137,8 +136,7 @@ bool IsPinnedToTaskbarHelper::ShortcutHasUnpinToTaskbarVerb(
long error_count = 0; long error_count = 0;
for (long i = 0; i < verb_count; ++i) { for (long i = 0; i < verb_count; ++i) {
Microsoft::WRL::ComPtr<FolderItemVerb> verb; Microsoft::WRL::ComPtr<FolderItemVerb> verb;
hresult = hresult = verbs->Item(base::win::ScopedVariant(i, VT_I4), &verb);
verbs->Item(base::win::ScopedVariant(i, VT_I4), verb.GetAddressOf());
if (FAILED(hresult) || !verb) { if (FAILED(hresult) || !verb) {
error_count++; error_count++;
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment