-
-
Notifications
You must be signed in to change notification settings - Fork 310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix call engine.destroy()
crash in Script
#1059
Conversation
Codecov ReportBase: 33.70% // Head: 34.17% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1059 +/- ##
==========================================
+ Coverage 33.70% 34.17% +0.47%
==========================================
Files 334 334
Lines 14458 14460 +2
Branches 2216 2212 -4
==========================================
+ Hits 4873 4942 +69
+ Misses 9058 8982 -76
- Partials 527 536 +9
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
packages/core/src/Script.ts
Outdated
} | ||
componentsManager.removeOnUpdateScript(this); | ||
componentsManager.removeOnLateUpdateScript(this); | ||
componentsManager.removeOnPhysicsUpdateScript(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to consider the case of -1, is it guaranteed not to have?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After this PR #1055 fixed, call onDisable before onEnable maybe never happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After this PR #1055 fixed, call onDisable before onEnable maybe never happen.
Even if fixed, the subscript of onUpdate
may be -1.
if (this.onUpdate !== prototype.onUpdate) {
componentsManager.addOnUpdateScript(this);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
if (this._waittingDestroy) { | ||
this._destroy(); | ||
} | ||
componentsManager.handlingInvalidScripts(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not put it before destroy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That not work, this._sceneManager._destroy();
is in this._destroy()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is still a situation:
onPointerDown() {
this.entity.destroy();
this.engine.destroy();
}
onDestroy() {
console.log('Destroyed at', this.engine.time.nowTime);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
* main: v0.8.0-beta.26 feat: shader add properties get ability (galacean#1060) Fix scene root entity destroy bug (galacean#1062) Fix call `engine.destroy()` crash in `Script` (galacean#1059) Fix physics system stablity (galacean#1047) v0.8.0-beta.25 Fix script onDisable() error call bug (galacean#1055) fix: sprite transform error when rotates (galacean#1053) feat: remove throw (galacean#1052) Update README.md Update README.md v0.8.0-beta.24 Fix `TextRenderer` render error (galacean#1040) v0.8.0-beta.23
Please check if the PR fulfills these requirements
Main modify: