Conversation
Gopmyc
commented
Sep 9, 2026
Gopmyc
left a comment
Contributor
Author
There was a problem hiding this comment.
The crash needs fixing, I'm sure of that. Less sure SOL_ALL_SAFETIES_ON is the tradeoff you want, given the cost in every config. Would rather have someone else weigh in
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.
Description
sol2 only enables its safety checks on debug builds. Release and Publish compile with
NDEBUG, soSOL_SAFE_USERTYPEis off and a member call with a badselfgoes down the unchecked branch incall.hpp. That branch dereferences a null userdata pointer instack_get_unqualified.hpp, so we get an access violation instead of a Lua error.Scene:FindActorByName("...")is one way to reach it. The globalSceneis the usertype metatable, not a scene instance (the instance comes fromScenes.GetCurrentScene()). Any bound member of the 36 registered usertypes does the same thing whenselfis wrong, and so do nil or mistyped arguments.I fixed it with a build define rather than in the bindings because sol2 already has the check, we just compile it out. Doing it by hand would mean validating
selfon every bound member of every usertype, then remembering it on each new binding. sol2 points to build defines for this insol/config.hpp, and patching the vendored header would be lost the next time we update the dependency.One thing to know before merging: Release and Publish now run integer precision checks as well.
Math.RandomInt(1, n / 2)raises an error instead of silently truncating, since/returns a float in Lua 5.3+. Debug builds have always behaved this way.Related Issue(s)
Fixes #828
Review Guidance
SOL_NO_LUA_HPPfrom Fix lua integration by disabling lua.hpp usage in sol2 #692. All sol2 translation units currently sit in OvCore, so scoping the define to that project works just as well if you prefer it there.selfand per argument on every bound call, in all configurations.SOL_SAFE_USERTYPEandSOL_SAFE_FUNCTION_CALLSon their own remove the crash without touching number handling.Scenes.GetCurrentScene()dereferencing a null scene.Screenshots/GIFs
N/A
AI Usage Disclosure
Debugging
Checklist