Skip to content

Commit b6dbdd2

Browse files
committed
added early-exit in various BuildTree methods when window is closing
1 parent d7d5fc3 commit b6dbdd2

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

Editor/Scripts/GCHandlesView/GCHandlesControl.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ public TreeViewItem BuildTree(PackedMemorySnapshot snapshot)
105105

106106
for (int n = 0, nend = m_Snapshot.gcHandles.Length; n < nend; ++n)
107107
{
108+
if (window.isClosing) // the window is closing
109+
break;
110+
108111
var gcHandle = m_Snapshot.gcHandles[n];
109112
var managedTypeIndex = -1;
110113
if (gcHandle.managedObjectsArrayIndex >= 0)

Editor/Scripts/ManagedHeapSectionsView/ManagedHeapSectionsControl.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ public TreeViewItem BuildTree(PackedMemorySnapshot snapshot, PackedMemorySection
9393

9494
for (int n = 0, nend = sections.Length; n < nend; ++n)
9595
{
96+
if (window.isClosing) // the window is closing
97+
break;
98+
9699
var section = sections[n];
97100

98101
var item = new HeapSectionItem()

Editor/Scripts/ManagedTypesView/ManagedTypesControl.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ public TreeViewItem BuildTree(PackedMemorySnapshot snapshot)
7171

7272
for (int n = 0, nend = m_Snapshot.managedTypes.Length; n < nend; ++n)
7373
{
74+
if (window.isClosing) // the window is closing
75+
break;
76+
7477
var type = m_Snapshot.managedTypes[n];
7578

7679
var item = new ManagedTypeItem

Editor/Scripts/StaticFieldsView/StaticFieldsControl.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ public TreeViewItem BuildTree(PackedMemorySnapshot snapshot)
108108

109109
for (int n = 0, nend = m_Snapshot.managedStaticTypes.Length; n < nend; ++n)
110110
{
111+
if (window.isClosing) // the window is closing
112+
break;
113+
111114
var type = m_Snapshot.managedTypes[m_Snapshot.managedStaticTypes[n]];
112115

113116
var group = new StaticTypeItem

0 commit comments

Comments
 (0)