Skip to content
This repository was archived by the owner on May 9, 2023. It is now read-only.

Commit 5207b1a

Browse files
committed
fix destroy logic with lists/dicts
1 parent 91d5fc2 commit 5207b1a

File tree

3 files changed

+12
-21
lines changed

3 files changed

+12
-21
lines changed

src/Inspectors/Reflection/CacheObject/CacheObjectBase.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ public virtual void Disable()
4343

4444
public void Destroy()
4545
{
46-
GameObject.Destroy(this.m_mainContent);
46+
if (this.m_mainContent)
47+
GameObject.Destroy(this.m_mainContent);
4748
}
4849

4950
public virtual void UpdateValue()

src/Inspectors/Reflection/InteractiveValue/InteractiveDictionary.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,13 @@ public override void OnValueUpdated()
6565
{
6666
RefIDictionary = Value as IDictionary;
6767

68-
if (Value != null)
68+
if (m_subContentParent.activeSelf)
6969
{
70-
if (m_subContentParent.activeSelf)
71-
{
72-
GetCacheEntries();
73-
RefreshDisplay();
74-
}
75-
else
76-
m_recacheWanted = true;
70+
GetCacheEntries();
71+
RefreshDisplay();
7772
}
7873
else
79-
m_entries.Clear();
74+
m_recacheWanted = true;
8075

8176
base.OnValueUpdated();
8277
}
@@ -122,7 +117,7 @@ public void GetCacheEntries()
122117
}
123118

124119
#if CPP
125-
if (RefIDictionary == null && !Value.IsNullOrDestroyed())
120+
if (RefIDictionary == null && Value != null)
126121
RefIDictionary = EnumerateWithReflection();
127122
#endif
128123

src/Inspectors/Reflection/InteractiveValue/InteractiveEnumerable.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,13 @@ public override void OnValueUpdated()
4949
RefIEnumerable = Value as IEnumerable;
5050
RefIList = Value as IList;
5151

52-
if (Value != null)
52+
if (m_subContentParent.activeSelf)
5353
{
54-
if (m_subContentParent.activeSelf)
55-
{
56-
GetCacheEntries();
57-
RefreshDisplay();
58-
}
59-
else
60-
m_recacheWanted = true;
54+
GetCacheEntries();
55+
RefreshDisplay();
6156
}
6257
else
63-
m_entries.Clear();
58+
m_recacheWanted = true;
6459

6560
base.OnValueUpdated();
6661
}
@@ -108,7 +103,7 @@ public void GetCacheEntries()
108103
}
109104

110105
#if CPP
111-
if (RefIEnumerable == null && !Value.IsNullOrDestroyed())
106+
if (RefIEnumerable == null && Value != null)
112107
RefIEnumerable = EnumerateWithReflection();
113108
#endif
114109

0 commit comments

Comments
 (0)