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

Commit 06e3213

Browse files
authored
Merge pull request #334 from UnityTech/fix_automatic_keep_alive
Fix automatic keep alive.
2 parents 8f8b9ea + 39bd903 commit 06e3213

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Runtime/widgets/automatic_keep_alive.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ bool _addClient(KeepAliveNotification notification) {
6767
}
6868
else {
6969
SchedulerBinding.instance.addPostFrameCallback(timeStamp => {
70+
if (!this.mounted) {
71+
return;
72+
}
7073
ParentDataElement childElement1 = this._getChildElement();
7174
D.assert(childElement1 != null);
7275
this._updateParentDataOfChild(childElement1);
@@ -78,6 +81,7 @@ bool _addClient(KeepAliveNotification notification) {
7881
}
7982

8083
ParentDataElement _getChildElement() {
84+
D.assert(this.mounted);
8185
Element element = (Element) this.context;
8286
Element childElement = null;
8387
element.visitChildren((Element child) => { childElement = child; });

0 commit comments

Comments
 (0)