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 current section update issues #6845

Merged
merged 4 commits into from
Jul 1, 2024

Conversation

APickledWalrus
Copy link
Member

Description

This PR fixes an important issue where, when loading a new section, Skript may fail to remove the newly-loaded section from the current sections list. This is caused by the methods holding onto an unsafe. This issue was exposed by #6699 which makes changes to the list being referenced. However, even before this PR, this was unsafe as the method ParserInstance#setCurrentSections exists (meaning any addons changing the list reference could introduce issues).

I have resolved this issue by creating and setting a copy of the current sections list, and then setting it back to the original list when it is time to exit.


Target Minecraft Versions: any
Requirements: none
*Related Issues:

It was possible to methods like loadCode to be holding onto invalid/no longer used current section list references
@APickledWalrus APickledWalrus added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. 2.9 Targeting a 2.9.X version release labels Jul 1, 2024
Copy link
Contributor

@ShaneBeee ShaneBeee left a comment

Choose a reason for hiding this comment

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

Tested and can confirm it works

@APickledWalrus APickledWalrus merged commit b48f66d into dev/feature Jul 1, 2024
5 checks passed
@APickledWalrus APickledWalrus deleted the patch/outdated-section-list-references branch July 1, 2024 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.9 Targeting a 2.9.X version release bug An issue that needs to be fixed. Alternatively, a PR fixing an issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants