Repository navigation
fix(script): invalidate book and block property components with their ItemStack - #383
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
ItemBookComponentandItemBlockDynamicPropertiesComponentnow behave like the game once theItemStackthey were taken from is gone:InvalidItemStackErrorwith the game's message,Failed to <get property|set property|call function> '<member>' due to the ItemStack being invalid (has the ItemStack been removed?).itemTypeon the error is theItemTypethe stack had when the component was takenComponent.isValidreturnsfalse;typeIdstill answersBefore this change Falcon never threw
InvalidItemStackError, soitemTypewas never readable, and the component kept its stack alive forever.How it was checked
Client 26.60 in IDA:
ItemStackplus a copy of the stack'sItemTypehandle; it drops the strong handle it was givenInvalidItemStackErrorfrom the action kind (get property/set property/call function), the member name and the storedItemType; the message format string and theItemStacknoun were read from the binary.d.tsof 2.12.0-beta.1.26.60 listInvalidItemStackErroron every member of these two classes, and only on themSince the script
ItemStackowns its native object, a chained temporary (new ItemStack(id).getComponent("book").pageCount) leaves the component dangling once the statement's temporary is released. Two existing tests used that pattern and now keep the stack in a variable.Tests:
ScriptApiTestscovers a dead book (getter and method), a dead block-properties component,isValidon both and a live component.Not built locally (syntax-checked with
clang++ -fsyntax-only); CI runs on the branch.AI disclosure
Code, research in the game binary and this description: Claude Opus 5.5 (
claude-opus-5-5).