Skip to content
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

Move app destroy to frame end #3230

Merged
merged 7 commits into from
Jun 11, 2021
Merged

Move app destroy to frame end #3230

merged 7 commits into from
Jun 11, 2021

Conversation

yaustar
Copy link
Contributor

@yaustar yaustar commented Jun 11, 2021

Fixes #3228

I'm really unsure about this as it is a kludge. I was thinking it might be better off as extra documentation for the function where app.destroy should not be called in an app.update.

I confirm I have read the contributing guidelines and signed the Contributor License Agreement.

@mvaligursky
Copy link
Contributor

It seems like a valid request to be able to shut down the application from within the update, and so I think the solution is fine.

@@ -408,6 +408,8 @@ class Application extends EventHandler {

app = this;

this._destroyThisFrame = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would perhaps rename this to _destroyRequested

@@ -2162,6 +2170,7 @@ var makeTick = function (_app) {
application._fillFrameStats();
// #endif

this._inFrameUpdate = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have this variable in the constructor as well please, to not introduce variables to class during running.

@yaustar
Copy link
Contributor Author

yaustar commented Jun 11, 2021

Made changes from review and here's the test project: https://playcanvas.com/editor/scene/1067584

@yaustar yaustar requested a review from a team June 11, 2021 13:16
@yaustar yaustar self-assigned this Jun 11, 2021
@yaustar yaustar added the bug label Jun 11, 2021
@yaustar yaustar merged commit bfb663c into master Jun 11, 2021
@yaustar yaustar deleted the move-app-destroy-to-frame-end branch June 11, 2021 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Calling app.destroy() in the middle of a frameUpdate causes crashes
3 participants