Fixed Segfault from DeleteImage() and DeleteMesh()

This commit is contained in:
n00b
2025-04-12 13:26:00 -04:00
parent b67d63d32c
commit edb6462752
7 changed files with 215 additions and 199 deletions

View File

@@ -4403,7 +4403,7 @@ int main(int argc, char * argv[])
}
#ifdef RCBASIC_DEBUG
rc_filename = "debug.cbc";
//rc_filename = "debug.cbc";
#endif // RCBASIC_DEBUG
//DEBUG START
@@ -4452,7 +4452,7 @@ int main(int argc, char * argv[])
//ogles2 test
#ifdef RC_TESTING
rc_intern_dirChange("/home/n00b/Programs/RCBasic_v401_Linux64/examples/Simple_3D_Platformer/");
rc_intern_dirChange("/home/n00b/test/Special Materials/");
//rc_intern_dirChange("");
rc_filename = "main.cbc";
#endif

View File

@@ -2467,7 +2467,7 @@ void rc_deleteImage(int img_id)
if(rc_image[img_id].image)
{
rc_image[img_id].image->drop();
VideoDriver->removeTexture(rc_image[img_id].image);
rc_image[img_id].image = NULL;
rc_image[img_id].alpha = 255;
}

View File

@@ -187,7 +187,12 @@ void rc_deleteMesh(int mesh_id)
return;
if(rc_mesh[mesh_id].mesh)
rc_mesh[mesh_id].mesh->drop();
{
if(rc_mesh[mesh_id].mesh->getReferenceCount() > 0)
{
SceneManager->getMeshCache()->removeMesh(rc_mesh[mesh_id].mesh);
}
}
rc_mesh[mesh_id].mesh = NULL;
rc_mesh[mesh_id].mesh_type = 0;

View File

@@ -2,7 +2,7 @@
#define RC_OS_DEFINES_H_INCLUDED
//USED FOR TESTING ONLY
//#define RC_TESTING
#define RC_TESTING
//I am checking Android first since I think it also defines __linux__

View File

@@ -1,5 +1,5 @@
# depslib dependency file v1.0
1744343721 source:/home/n00b/Projects/RCBASIC4/rcbasic_runtime/main.cpp
1744470357 source:/home/n00b/Projects/RCBASIC4/rcbasic_runtime/main.cpp
"rc_os_defines.h"
<emscripten.h>
<sys/param.h>
@@ -33,7 +33,7 @@
<irrtheora.h>
"rc_func130_cases.h"
1744343669 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_os_defines.h
1744470357 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_os_defines.h
<TargetConditionals.h>
1744330643 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_defines.h
@@ -1248,7 +1248,7 @@
1734372058 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/RealisticWater.h
<irrlicht.h>
1744257792 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_gfx.h
1744470508 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_gfx.h
"SDL.h"
<SDL2/SDL.h>
<irrlicht.h>
@@ -2534,7 +2534,7 @@
1734372966 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_constraint.h
1738504435 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_mesh.h
1744478025 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_mesh.h
1734372058 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_particles.h
@@ -2576,6 +2576,7 @@
1744345468 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/ProjectiveTextures.h
<irrlicht.h>
1744345176 source:/home/n00b/Projects/RCBASIC4/rcbasic_runtime/ProjectiveTextures.cpp
1744345468 source:/home/n00b/Projects/RCBASIC4/rcbasic_runtime/ProjectiveTextures.cpp
"ProjectiveTextures.h"
<string>

View File

@@ -2,85 +2,17 @@
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Debug" />
<File name="rc_joints.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="310" topLine="0" />
</Cursor>
</File>
<File name="gui_freetype_font.cpp" open="0" top="0" tabpos="24" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="792" topLine="0" />
</Cursor>
</File>
<File name="rc_actor_animation.h" open="0" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6134" topLine="75" />
</Cursor>
</File>
<File name="main.cpp" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="130210" topLine="4303" />
</Cursor>
</File>
<File name="rc_geometry.h" open="0" top="0" tabpos="20" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="20919" topLine="652" />
</Cursor>
</File>
<File name="rc_font.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="rc_net.h" open="0" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3769" topLine="186" />
</Cursor>
</File>
<File name="rc_stdlib.h" open="0" top="0" tabpos="18" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="24491" topLine="1083" />
</Cursor>
</File>
<File name="rc_spritelib.h" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="18902" topLine="678" />
</Cursor>
</File>
<File name="rc_video.h" open="0" top="0" tabpos="21" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="169" topLine="6" />
</Cursor>
</File>
<File name="gui_freetype_font.h" open="0" top="0" tabpos="23" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="183" topLine="0" />
</Cursor>
</File>
<File name="../../irrBullet/src/irrBulletCollisionObject.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="384" />
</Cursor>
</File>
<File name="rc_constraint.h" open="0" top="0" tabpos="15" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="8391" topLine="231" />
</Cursor>
</File>
<File name="rc_gfx_core.h" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1853" topLine="75" />
</Cursor>
<Folding>
<Collapse line="85" />
</Folding>
</File>
<File name="rc_test.h" open="0" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="115" topLine="0" />
</Cursor>
</File>
<File name="rc_windowclose.h" open="1" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="CShader.cpp" open="1" top="0" tabpos="19" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="10120" topLine="352" />
</Cursor>
</File>
<File name="rc_windowclose.h" open="1" top="0" tabpos="21" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="18958" topLine="206" />
</Cursor>
@@ -90,39 +22,34 @@
<Collapse line="555" />
</Folding>
</File>
<File name="rc_defines.h" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="rc_net.h" open="0" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="190390" topLine="2847" />
<Cursor1 position="3769" topLine="186" />
</Cursor>
</File>
<File name="rc_gfx3D.h" open="0" top="0" tabpos="14" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="rc_media.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="565" topLine="0" />
<Cursor1 position="17752" topLine="630" />
</Cursor>
</File>
<File name="rc_os_defines.h" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="camera.h" open="1" top="0" tabpos="22" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="91" topLine="0" />
<Cursor1 position="4654" topLine="100" />
</Cursor>
</File>
<File name="rc_physics3D_base.h" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="rc_actor_physics.h" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3283" topLine="66" />
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="rc_audio.h" open="0" top="0" tabpos="18" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="rc_actor_animation.h" open="0" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6531" topLine="311" />
<Cursor1 position="6134" topLine="75" />
</Cursor>
</File>
<File name="CShader.h" open="1" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="rc_video.h" open="0" top="0" tabpos="21" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1197" topLine="46" />
</Cursor>
</File>
<File name="RealisticWater.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="7671" topLine="204" />
<Cursor1 position="169" topLine="6" />
</Cursor>
</File>
<File name="rc_matrix.h" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@@ -130,12 +57,35 @@
<Cursor1 position="116" topLine="804" />
</Cursor>
</File>
<File name="rc_particles.h" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="rc_base_actor.h" open="1" top="0" tabpos="26" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6262" topLine="615" />
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="rc_scene.h" open="1" top="0" tabpos="14" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="rc_func130_cases.h" open="1" top="0" tabpos="25" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="134546" topLine="2964" />
</Cursor>
</File>
<File name="rc_fx_materials.h" open="1" top="0" tabpos="15" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="16692" topLine="566" />
</Cursor>
<Folding>
<Collapse line="47" />
</Folding>
</File>
<File name="rc_gfx.h" open="1" top="1" tabpos="20" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="62421" topLine="2461" />
</Cursor>
</File>
<File name="rc_joints.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="310" topLine="0" />
</Cursor>
</File>
<File name="rc_scene.h" open="1" top="0" tabpos="23" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1298" topLine="28" />
</Cursor>
@@ -145,77 +95,19 @@
<Cursor1 position="13990" topLine="0" />
</Cursor>
</File>
<File name="rc_sprite2D.h" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="111" topLine="0" />
</Cursor>
</File>
<File name="CShader.cpp" open="1" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1550" topLine="44" />
</Cursor>
</File>
<File name="rc_actor_material.h" open="1" top="1" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="29204" topLine="1010" />
</Cursor>
</File>
<File name="rc_fx_materials.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="7366" topLine="223" />
</Cursor>
<Folding>
<Collapse line="47" />
</Folding>
</File>
<File name="rc_tilemap.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="243" topLine="26" />
</Cursor>
</File>
<File name="rc_func130_cases.h" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="123127" topLine="2739" />
</Cursor>
</File>
<File name="rc_gfx.h" open="1" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="25187" topLine="1061" />
</Cursor>
</File>
<File name="../../irrBullet/src/irrBulletWorld.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2750" topLine="75" />
</Cursor>
</File>
<File name="../../irrBullet/src/irrBulletRigidBody.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2046" topLine="42" />
</Cursor>
</File>
<File name="rc_tilelib.h" open="0" top="0" tabpos="22" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="rc_stdlib.h" open="1" top="0" tabpos="24" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3693" topLine="136" />
<Cursor1 position="24491" topLine="1074" />
</Cursor>
</File>
<File name="../../irrBullet/src/irrBullet.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="gui_freetype_font.cpp" open="0" top="0" tabpos="24" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="7" />
</Cursor>
</File>
<File name="rc_actor_physics.h" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="rc_base_actor.h" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="41012" topLine="1498" />
</Cursor>
</File>
<File name="../../irrBullet/src/irrBulletcommon.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="924" topLine="6" />
<Cursor1 position="792" topLine="0" />
</Cursor>
</File>
<File name="rc_mesh.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@@ -223,14 +115,132 @@
<Cursor1 position="5389" topLine="242" />
</Cursor>
</File>
<File name="rc_media.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="rc_physics3D_base.h" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="17752" topLine="630" />
<Cursor1 position="3283" topLine="66" />
</Cursor>
</File>
<File name="camera.h" open="1" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="../../irrBullet/src/irrBullet.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4654" topLine="100" />
<Cursor1 position="0" topLine="7" />
</Cursor>
</File>
<File name="rc_tilemap.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="243" topLine="26" />
</Cursor>
</File>
<File name="rc_os_defines.h" open="1" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="93" topLine="0" />
</Cursor>
</File>
<File name="rc_geometry.h" open="0" top="0" tabpos="20" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="20919" topLine="652" />
</Cursor>
</File>
<File name="rc_spritelib.h" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="18902" topLine="678" />
</Cursor>
</File>
<File name="rc_audio.h" open="0" top="0" tabpos="18" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6531" topLine="311" />
</Cursor>
</File>
<File name="gui_freetype_font.h" open="0" top="0" tabpos="23" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="183" topLine="0" />
</Cursor>
</File>
<File name="rc_actor_material.h" open="1" top="0" tabpos="16" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5301" topLine="744" />
</Cursor>
</File>
<File name="main.cpp" open="1" top="0" tabpos="14" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="130603" topLine="4390" />
</Cursor>
</File>
<File name="../../irrBullet/src/irrBulletCollisionObject.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="384" />
</Cursor>
</File>
<File name="rc_gfx3D.h" open="0" top="0" tabpos="14" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="565" topLine="0" />
</Cursor>
</File>
<File name="rc_gfx_core.h" open="1" top="0" tabpos="17" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="14625" topLine="417" />
</Cursor>
<Folding>
<Collapse line="85" />
</Folding>
</File>
<File name="RealisticWater.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="7671" topLine="204" />
</Cursor>
</File>
<File name="ProjectiveTextures.h" open="1" top="0" tabpos="27" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="110" topLine="0" />
</Cursor>
</File>
<File name="rc_particles.h" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6262" topLine="615" />
</Cursor>
</File>
<File name="rc_font.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="CShader.h" open="1" top="0" tabpos="18" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2314" topLine="101" />
</Cursor>
</File>
<File name="../../irrBullet/src/irrBulletWorld.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2750" topLine="75" />
</Cursor>
</File>
<File name="rc_defines.h" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="190390" topLine="2847" />
</Cursor>
</File>
<File name="ProjectiveTextures.cpp" open="1" top="0" tabpos="28" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="348" topLine="0" />
</Cursor>
</File>
<File name="../../irrBullet/src/irrBulletcommon.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="924" topLine="6" />
</Cursor>
</File>
<File name="rc_constraint.h" open="0" top="0" tabpos="15" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="8391" topLine="231" />
</Cursor>
</File>
<File name="rc_tilelib.h" open="0" top="0" tabpos="22" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3693" topLine="136" />
</Cursor>
</File>
<File name="rc_sprite2D.h" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="111" topLine="0" />
</Cursor>
</File>
</CodeBlocks_layout_file>