Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Commit 5a5f3eb

Browse files
author
Yuncong Zhang
committed
Update listener_helpers
1 parent c846010 commit 5a5f3eb

File tree

4 files changed

+31
-17
lines changed

4 files changed

+31
-17
lines changed

Runtime/animation/listener_helpers.mixin.gen.cs

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@ public override void addListener(VoidCallback listener) {
6161
}
6262

6363
public override void removeListener(VoidCallback listener) {
64-
this._listeners.Remove(listener);
65-
this.didUnregisterListener();
64+
bool removed = this._listeners.Remove(listener);
65+
if(removed) {
66+
this.didUnregisterListener();
67+
}
6668
}
6769

6870
public void notifyListeners() {
@@ -98,8 +100,10 @@ public override void addListener(VoidCallback listener) {
98100
}
99101

100102
public override void removeListener(VoidCallback listener) {
101-
this._listeners.Remove(listener);
102-
this.didUnregisterListener();
103+
bool removed = this._listeners.Remove(listener);
104+
if(removed) {
105+
this.didUnregisterListener();
106+
}
103107
}
104108

105109
public void notifyListeners() {
@@ -136,8 +140,10 @@ public override void addStatusListener(AnimationStatusListener listener) {
136140
}
137141

138142
public override void removeStatusListener(AnimationStatusListener listener) {
139-
this._statusListeners.Remove(listener);
140-
this.didUnregisterListener();
143+
bool removed = this._statusListeners.Remove(listener);
144+
if(removed) {
145+
this.didUnregisterListener();
146+
}
141147
}
142148

143149
public void notifyStatusListeners(AnimationStatus status) {
@@ -173,8 +179,10 @@ public override void addStatusListener(AnimationStatusListener listener) {
173179
}
174180

175181
public override void removeStatusListener(AnimationStatusListener listener) {
176-
this._statusListeners.Remove(listener);
177-
this.didUnregisterListener();
182+
bool removed = this._statusListeners.Remove(listener);
183+
if(removed) {
184+
this.didUnregisterListener();
185+
}
178186
}
179187

180188
public void notifyStatusListeners(AnimationStatus status) {
@@ -210,8 +218,10 @@ public override void addStatusListener(AnimationStatusListener listener) {
210218
}
211219

212220
public override void removeStatusListener(AnimationStatusListener listener) {
213-
this._statusListeners.Remove(listener);
214-
this.didUnregisterListener();
221+
bool removed = this._statusListeners.Remove(listener);
222+
if(removed) {
223+
this.didUnregisterListener();
224+
}
215225
}
216226

217227
public void notifyStatusListeners(AnimationStatus status) {

Runtime/animation/listener_helpers.mixin.njk

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@ namespace Unity.UIWidgets.animation {
6262
}
6363

6464
public override void removeListener(VoidCallback listener) {
65-
this._listeners.Remove(listener);
66-
this.didUnregisterListener();
65+
bool removed = this._listeners.Remove(listener);
66+
if(removed) {
67+
this.didUnregisterListener();
68+
}
6769
}
6870

6971
public void notifyListeners() {
@@ -103,8 +105,10 @@ namespace Unity.UIWidgets.animation {
103105
}
104106

105107
public override void removeStatusListener(AnimationStatusListener listener) {
106-
this._statusListeners.Remove(listener);
107-
this.didUnregisterListener();
108+
bool removed = this._statusListeners.Remove(listener);
109+
if(removed) {
110+
this.didUnregisterListener();
111+
}
108112
}
109113

110114
public void notifyStatusListeners(AnimationStatus status) {

Runtime/foundation/node.mixin.gen.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ CanonicalMixinDiagnosticableTree _getCanonical() {
204204

205205
static readonly Dictionary<_DependencyList, WeakReference> _canonicalObjects =
206206
new Dictionary<_DependencyList, WeakReference>();
207-
208-
public bool pureWidget { get; set; } // pure = false, if canonicalEquals should not be used.
207+
208+
public bool pureWidget { get; set; } // if canonicalEquals should not be used.
209209

210210
public override bool Equals(object obj) {
211211
if (ReferenceEquals(null, obj)) {

Runtime/rendering/object.mixin.gen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ public int childCount {
994994
get { return this._childCount; }
995995
}
996996

997-
public new bool debugValidateChild(RenderObject child) {
997+
public bool debugValidateChild(RenderObject child) {
998998
D.assert(() => {
999999
if (!(child is ChildType)) {
10001000
throw new UIWidgetsError(

0 commit comments

Comments
 (0)