Skip to content

Commit e987626

Browse files
committed
Adjust the judgment of IsAccessibilityObjectCreated in the ReleaseUiaProvider method of ListView and ListViewItem
1 parent e36dddd commit e987626

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/System.Windows.Forms/System/Windows/Forms/Controls/ListView/ListView.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5091,9 +5091,12 @@ internal override void ReleaseUiaProvider(HWND handle)
50915091
return;
50925092
}
50935093

5094-
for (int i = 0; i < Items.Count; i++)
5094+
if (IsAccessibilityObjectCreated)
50955095
{
5096-
Items.GetItemByIndex(i)?.ReleaseUiaProvider();
5096+
for (int i = 0; i < Items.Count; i++)
5097+
{
5098+
Items.GetItemByIndex(i)?.ReleaseUiaProvider();
5099+
}
50975100
}
50985101

50995102
if (_defaultGroup is not null)

src/System.Windows.Forms/System/Windows/Forms/Controls/ListView/ListViewItem.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,11 +1011,6 @@ internal void Host(ListView parent, int id, int index)
10111011

10121012
internal void ReleaseUiaProvider()
10131013
{
1014-
if (!IsAccessibilityObjectCreated)
1015-
{
1016-
return;
1017-
}
1018-
10191014
if (OsVersion.IsWindows8OrGreater())
10201015
{
10211016
if (_accessibilityObject is ListViewItemBaseAccessibleObject itemAccessibleObject)

0 commit comments

Comments
 (0)