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(
Microsoft::WRL::ComPtr<Folder> folder;
hresult = shell_dispatch->NameSpace(
base::win::ScopedVariant(shortcut.DirName().value().c_str()),
folder.GetAddressOf());
base::win::ScopedVariant(shortcut.DirName().value().c_str()), &folder);
if (FAILED(hresult) || !folder) {
error_occured_ = true;
return false;
......@@ -114,14 +113,14 @@ bool IsPinnedToTaskbarHelper::ShortcutHasUnpinToTaskbarVerb(
Microsoft::WRL::ComPtr<FolderItem> item;
hresult = folder->ParseName(
base::win::ScopedBstr(shortcut.BaseName().value()), item.GetAddressOf());
base::win::ScopedBstr(shortcut.BaseName().value()), &item);
if (FAILED(hresult) || !item) {
error_occured_ = true;
return false;
}
Microsoft::WRL::ComPtr<FolderItemVerbs> verbs;
hresult = item->Verbs(verbs.GetAddressOf());
hresult = item->Verbs(&verbs);
if (FAILED(hresult) || !verbs) {
error_occured_ = true;
return false;
......@@ -137,8 +136,7 @@ bool IsPinnedToTaskbarHelper::ShortcutHasUnpinToTaskbarVerb(
long error_count = 0;
for (long i = 0; i < verb_count; ++i) {
Microsoft::WRL::ComPtr<FolderItemVerb> verb;
hresult =
verbs->Item(base::win::ScopedVariant(i, VT_I4), verb.GetAddressOf());
hresult = verbs->Item(base::win::ScopedVariant(i, VT_I4), &verb);
if (FAILED(hresult) || !verb) {
error_count++;
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