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

Fix invokeJS crashing when reloading the mod #380

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

mattco98
Copy link
Member

TODO: Test packet trigger changes to make sure there are no issues. Also make sure performance isn't impacted

Rhino's context system is really only a wrapper around some internal
thread-local engine state. It's not super important for us to manage in
such a fine degree. What's much more important are the scope objects,
which are shared by default.

The main issue with our previous approach is that when the user executes
a "/ct load", we reload the mod from a background thread. This associates
the "moduleContext" with that background thread, making future uses of it
invalid. The fix is to get rid of all the stored contexts and just call
"enterContext" everywhere. The contexts are caches in a thread-local, so
it isn't that expensive. We can also batch certain calls in the future.
This can call into engine code, which will lead to a game crash if we
are unloaded.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant