1
0
Fork 0
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:
Reuh 2015-08-22 17:52:50 +02:00
parent 2a5513473d
commit d662e5509d
3 changed files with 13 additions and 10 deletions

View file

@ -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;
}