Pass lua_State* to inline destructors as well#2454
Open
PhoenixWhitefire wants to merge 6 commits into
Open
Conversation
Collaborator
Collaborator
|
We will probably be moving to take the path where we will try to api_check all invalid uses from inside GC (edit: in the future separately from this PR). |
Contributor
Author
Would this be like asserting the GC state in the barriers? |
Collaborator
|
Not asserting on a GC state, we will likely have a flag raised for the duration of the callback specifically. |
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.
Currently, inline destructors set with
lua_newuserdatadtordo not receive anL, while tag-based destructors do (#467).This can be inconvenient if the
lua_State*is needed during the destruction process, such as for alua_getthreaddata, or to release a reference, where they are instead forced to store theLin their userdata object (e.g. @Bottersnike/eryx/src/modules/_fs_watch.cpp#L132). Embedders would be accepting the same risk that already exists with tag-based destructors.This PR changes
lua_newuserdatadtorto instead take alua_Destructor, same aslua_setuserdatadtor, and passes the sameLit would for tag-based destructors.