[accessibility] Fix text provider reference leaks
Return a ComPtr rather than a naked pointer from the AXPlatformNodeTextProviderWin and AXPlatformNodeTextChildProviderWin factory functions. This fixes a reference leak from each. AX-Relnotes: n/a. Bug: 40665982 Change-Id: I824baf49c2de8a771abf4aeced226186368f5d54 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6317405 Auto-Submit: Greg Thompson <grt@chromium.org> Commit-Queue: Benjamin Beaudry <benjamin.beaudry@microsoft.com> Reviewed-by: Benjamin Beaudry <benjamin.beaudry@microsoft.com> Cr-Commit-Position: refs/heads/main@{#1427162}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
5ac4fe9e82
commit
c73067902d
@ -34,14 +34,13 @@ AXPlatformNodeTextChildProviderWin::AXPlatformNodeTextChildProviderWin() {}
|
||||
AXPlatformNodeTextChildProviderWin::~AXPlatformNodeTextChildProviderWin() {}
|
||||
|
||||
// static
|
||||
AXPlatformNodeTextChildProviderWin* AXPlatformNodeTextChildProviderWin::Create(
|
||||
AXPlatformNodeWin* owner) {
|
||||
Microsoft::WRL::ComPtr<AXPlatformNodeTextChildProviderWin>
|
||||
AXPlatformNodeTextChildProviderWin::Create(AXPlatformNodeWin* owner) {
|
||||
CComObject<AXPlatformNodeTextChildProviderWin>* text_child_provider = nullptr;
|
||||
if (SUCCEEDED(CComObject<AXPlatformNodeTextChildProviderWin>::CreateInstance(
|
||||
&text_child_provider))) {
|
||||
DCHECK(text_child_provider);
|
||||
text_child_provider->owner_ = owner;
|
||||
text_child_provider->AddRef();
|
||||
return text_child_provider;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,8 @@ class COMPONENT_EXPORT(AX_PLATFORM) AXPlatformNodeTextChildProviderWin
|
||||
AXPlatformNodeTextChildProviderWin();
|
||||
~AXPlatformNodeTextChildProviderWin();
|
||||
|
||||
static AXPlatformNodeTextChildProviderWin* Create(AXPlatformNodeWin* owner);
|
||||
static Microsoft::WRL::ComPtr<AXPlatformNodeTextChildProviderWin> Create(
|
||||
AXPlatformNodeWin* owner);
|
||||
static void CreateIUnknown(AXPlatformNodeWin* owner, IUnknown** unknown);
|
||||
|
||||
// Retrieves this element's nearest ancestor provider that supports the Text
|
||||
|
@ -29,14 +29,13 @@ AXPlatformNodeTextProviderWin::AXPlatformNodeTextProviderWin() {}
|
||||
AXPlatformNodeTextProviderWin::~AXPlatformNodeTextProviderWin() {}
|
||||
|
||||
// static
|
||||
AXPlatformNodeTextProviderWin* AXPlatformNodeTextProviderWin::Create(
|
||||
AXPlatformNodeWin* owner) {
|
||||
Microsoft::WRL::ComPtr<AXPlatformNodeTextProviderWin>
|
||||
AXPlatformNodeTextProviderWin::Create(AXPlatformNodeWin* owner) {
|
||||
CComObject<AXPlatformNodeTextProviderWin>* text_provider = nullptr;
|
||||
if (SUCCEEDED(CComObject<AXPlatformNodeTextProviderWin>::CreateInstance(
|
||||
&text_provider))) {
|
||||
DCHECK(text_provider);
|
||||
text_provider->owner_ = owner;
|
||||
text_provider->AddRef();
|
||||
return text_provider;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,8 @@ class COMPONENT_EXPORT(AX_PLATFORM) __declspec(
|
||||
AXPlatformNodeTextProviderWin();
|
||||
~AXPlatformNodeTextProviderWin();
|
||||
|
||||
static AXPlatformNodeTextProviderWin* Create(AXPlatformNodeWin* owner);
|
||||
static Microsoft::WRL::ComPtr<AXPlatformNodeTextProviderWin> Create(
|
||||
AXPlatformNodeWin* owner);
|
||||
static void CreateIUnknown(AXPlatformNodeWin* owner, IUnknown** unknown);
|
||||
|
||||
//
|
||||
|
Reference in New Issue
Block a user