summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjussi2023-05-09 23:48:09 +0300
committerjussi2023-05-09 23:48:09 +0300
commit1e58f551bbfb6a8ef4d83292685d7c3672385c8b (patch)
treea4fbc3e1bf03c72c08ed398795997528f27fcb8f /src
parent429a9dff96a5dbe1f526ae7cc6e41815eb862cf0 (diff)
downloadreilua-enhanced-1e58f551bbfb6a8ef4d83292685d7c3672385c8b.tar.gz
reilua-enhanced-1e58f551bbfb6a8ef4d83292685d7c3672385c8b.tar.bz2
reilua-enhanced-1e58f551bbfb6a8ef4d83292685d7c3672385c8b.zip
UnloadTexture did not set texture id to NULL.
Diffstat (limited to 'src')
-rw-r--r--src/core.c1
-rw-r--r--src/state.c4
-rw-r--r--src/textures.c3
3 files changed, 3 insertions, 5 deletions
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;