-
-
Notifications
You must be signed in to change notification settings - Fork 4
Get rid of undefined behaviour #9
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
Conversation
|
So I was playing around and found out that my faulty timer implementation was not the issue for the multiple mutable borrows. You can reproduce it by implementing any events inside your gamemode that:
This is because the mutable reference to the script is being held while waiting for the return value of the event implementation. During the execution, the gamemode triggers a new event that also attempts to borrow the script mutably. Therefore, I think that the measures taken in #8 must be reverted since it introduces undefined behavior. |
Sreyas-Sreelal
left a comment
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.
Sorry for late reply. Thanks a lot, this is incredible work!
Working on #8 I realized, that we could refactor the scripts iteration. This PR allows us to remove 385 lines of code. Also, this way it will be easier to make necessary adjustments to the iteration once needed.
This could be the case very soon, because I noticed that I was implementing timers (inside my gamemode) in a bad way. Instead of using
events::on_tick(), I spawned a new thread that would tick on its own. Therefore I believe, that the panic was intended and the borrow checkers needs to be brought back. I will test it this week and upstream necessary changes.