From 1e58f551bbfb6a8ef4d83292685d7c3672385c8b Mon Sep 17 00:00:00 2001 From: jussi Date: Tue, 9 May 2023 23:48:09 +0300 Subject: UnloadTexture did not set texture id to NULL. --- changelog | 1 + devnotes | 1 + src/core.c | 1 - src/state.c | 4 ++-- src/textures.c | 3 +-- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/changelog b/changelog index 44ca81e..af122f5 100644 --- a/changelog +++ b/changelog @@ -67,6 +67,7 @@ Detailed changes: - FIXED: Vector3RotateByAxisAngle was not connected. - FIXED: uluaGetBoundingBoxIndex was looking for numbers instead of tables. - ADDED: IsTextureReady + - FIXED: UnloadTexture did not set texture id to NULL. ------------------------------------------------------------------------ Release: ReiLua version 0.4.0 Using Raylib 4.2 diff --git a/devnotes b/devnotes index 6cb0061..498cce5 100644 --- a/devnotes +++ b/devnotes @@ -1,4 +1,5 @@ Current { + * Review GenMeshCustom indices. } Backlog { diff --git a/src/core.c b/src/core.c index a0ea6ce..11feb35 100644 --- a/src/core.c +++ b/src/core.c @@ -1251,7 +1251,6 @@ int lcoreSetShaderValueTexture( lua_State *L ) { lua_pushboolean( L, false ); return 1; } - // SetShaderValueTexture( *state->shaders[ shaderId ], locIndex, *state->textures[ textureId ] ); SetShaderValueTexture( *state->shaders[ shaderId ], locIndex, *texturesGetSourceTexture( textureId ) ); lua_pushboolean( L, true ); diff --git a/src/state.c b/src/state.c index 6db0812..ce7d52f 100644 --- a/src/state.c +++ b/src/state.c @@ -122,13 +122,13 @@ void stateFree() { for ( int i = 0; i < state->imageCount; ++i ) { if ( state->images[i] != NULL ) { UnloadImage( *state->images[i] ); - free( state->images[i] ); + // free( state->images[i] ); } } for ( int i = 0; i < state->textureCount; ++i ) { if ( state->textures[i] != NULL ) { texturesFreeTexture(i); - free( state->textures[i] ); + // free( state->textures[i] ); } } for ( int i = 0; i < state->fontCount; ++i ) { diff --git a/src/textures.c b/src/textures.c index 291a7ad..04cd9d5 100644 --- a/src/textures.c +++ b/src/textures.c @@ -111,6 +111,7 @@ void texturesFreeTexture( size_t id ) { UnloadRenderTexture( state->textures[id]->renderTexture ); break; } + state->textures[id] = NULL; } } /* @@ -1746,9 +1747,7 @@ int ltexturesUnloadTexture( lua_State *L ) { lua_pushboolean( L, false ); return 1; } - // UnloadTexture( *state->textures[ id ] ); texturesFreeTexture( texId ); - // state->textures[ id ] = NULL; lua_pushboolean( L, true ); return 1; -- cgit v1.2.3