-
Notifications
You must be signed in to change notification settings - Fork 133
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
ScriptLoader will continue loading after AppRuntime/JsRuntime is destroyed #1225
Comments
@bghgary Is adding a cancellation source enough in this case? |
I don't think so. The problem is that the script loader doesn't know when the JS is going down. The app creates a script loader but doesn't hold on to it. If the app does hold a script loader, then it can work. |
This issue is very easy to reproduce: quickly press the 'R' key twice. Babylon::ScriptLoader loader{runtime};
loader.LoadScript(...);
Edit:
|
I cannot reproduce this click issue (occasional bugs?), but there are indeed a series of runtime-related issues in the source code:
I have observed that the interface bindings are currently implemented mainly by saving references. Our goal is to reset the context environment, and in reality, we only need to reset the JS Engine context and clear all tasks accumulated in m_workQueue. It is not necessary to destroy AppRuntime and then recreate it. I suggest AppRuntime created only once, using Edit: Currently, I have only identified two locations: I suggest adding notification events in |
@bghgary would it be enough to make ScriptLoader::Impl inherit from JsRuntime::IDisposingCallback and make the corresponding plumbing? |
If ScriptLoader is set up to load a script asynchronously and the app shutdown before the script is loaded, the script loader will continue trying to load the script since there are no cancellation sources associated with the tasks.
Perhaps the ScriptLoader should be owned by JS so that it will know when the JS goes down.
The text was updated successfully, but these errors were encountered: