mirror of
https://github.com/ctruLua/ctruLua.git
synced 2025-10-27 16:39:29 +00:00
Fixed freeze when Lua tried to garbage collect a unloaded texture
This commit is contained in:
parent
2a5513473d
commit
d662e5509d
3 changed files with 13 additions and 10 deletions
|
|
@ -109,9 +109,10 @@ static int texture_drawPartBlend(lua_State *L) {
|
|||
static int texture_unload(lua_State *L) {
|
||||
texture_userdata *texture = luaL_checkudata(L, 1, "LTexture");
|
||||
|
||||
if (texture->texture != NULL) sf2d_free_texture(texture->texture);
|
||||
if (texture->texture == NULL) return 0;
|
||||
|
||||
sf2d_free_texture(texture->texture);
|
||||
texture->texture = NULL;
|
||||
free(texture);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue