mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Fixed objects which store Lua callback functions to avoid attempting to use dead coroutines when deleting the reference to the callback function. Should fix crashes when coroutines are mixed with those objects.
Also improved the performance of World:rayCast and World:queryBoundingBox.
This commit is contained in:
+7
-26
@@ -64,36 +64,17 @@ public:
|
||||
void unref();
|
||||
|
||||
/**
|
||||
* Pushes the referred value onto the stack of a different coroutine
|
||||
* in the same main Lua state.
|
||||
* THIS SHOULD NOT BE USED FOR DIFFERENT LUA STATES (created with
|
||||
* luaL_newstate)! Only with different coroutines!
|
||||
* Pushes the referred value onto the stack of the specified Lua coroutine.
|
||||
* NOTE: The coroutine *must* belong to the same Lua state that was used for
|
||||
* Reference::ref.
|
||||
**/
|
||||
void push(lua_State *newL);
|
||||
|
||||
/**
|
||||
* Pushes the referred value onto the stack.
|
||||
**/
|
||||
void push();
|
||||
|
||||
/**
|
||||
* Gets the Lua state associated with this
|
||||
* reference.
|
||||
**/
|
||||
lua_State *getL() const;
|
||||
|
||||
/**
|
||||
* Associates a new Lua state with this reference.
|
||||
* THIS IS DANGEROUS! It is only designed to be
|
||||
* used with different coroutines from the same
|
||||
* main Lua state!
|
||||
**/
|
||||
void setL(lua_State *newL);
|
||||
void push(lua_State *L);
|
||||
|
||||
private:
|
||||
|
||||
// The Lua state in which the reference resides.
|
||||
lua_State *L;
|
||||
// A pinned coroutine (probably the main thread) belonging to the Lua state
|
||||
// in which the reference resides.
|
||||
lua_State *pinnedL;
|
||||
|
||||
// Index to the Lua reference.
|
||||
int idx;
|
||||
|
||||
Reference in New Issue
Block a user