Segmentation fault when compiling in the Sniper SRL.

I am building my game in the Steam Runtime Sniper. g++ (SteamRT 10.3.0-3+steamrt3.1+bsrt3.1) 10.3.0 . When building in the environment I get a segmentation fault when running that build on my local machine. I get the seg fault when going to the options menu of my game. There appears to be an issue with rendering this particular UI Element. Note that when I build locally on g++ (GCC) 14.2.1 it works fine

One of the UI Elements I add using some function pointers.

When I run gdb and do a backtrace I see this:

Thread 1 “sdl2-blocks” received signal SIGSEGV, Segmentation fault.
0x00007ffff7e16594 in SDL_RenderCopyF_REAL (renderer=0x555555ae0050, texture=0x8, srcrect=0x7fffffffd020, dstrect=0x7fffffffcfd0)
at /usr/src/debug/SDL2-2.30.9-1.fc41.x86_64/src/render/SDL_render.c:3416
3416 CHECK_TEXTURE_MAGIC(texture, -1);
(gdb) backtrace
#0 0x00007ffff7e16594 in SDL_RenderCopyF_REAL (renderer=0x555555ae0050, texture=0x8, srcrect=0x7fffffffd020, dstrect=0x7fffffffcfd0)
at /usr/src/debug/SDL2-2.30.9-1.fc41.x86_64/src/render/SDL_render.c:3416
#1 0x00007ffff7e16964 in SDL_RenderCopy_REAL
(renderer=, texture=, srcrect=, dstrect=)
at /usr/src/debug/SDL2-2.30.9-1.fc41.x86_64/src/render/SDL_render.c:3404
#2 0x000055555557b5d3 in ley::UIMenu::renderHotItem (this=0x5555559fb688, v=0x7fffffffd300) at UIMenu.cpp:172
#3 0x000055555557b7be in ley::UIMenu::render (this=0x5555559fb688, v=0x7fffffffd300) at UIMenu.cpp:200
#4 0x000055555558944b in ley::OptionMenuState::render (this=0x5555559fb2c0) at src/State/OptionMenuState.cpp:108
#5 0x00005555555b6561 in ley::GameStateMachine::render (this=0x7fffffffd228) at src/State/GameStateMachine.cpp:55
#6 0x0000555555574186 in ley::GameController::runGameLoop (this=0x7fffffffd210) at GameController.cpp:53
#7 0x000055555555cd35 in main (argv=1, args=0x7fffffffddd8) at sdl2-blocks.cpp:39

Does anyone have any tips on how I should approach trying to resolve this?

Thanks,
Electrosys

I think I figured it out. I added some empty values for the special UI Element case so that I can skip rendering the parts that are empty.

Here I add the empty values:

And here is where I skip rendering:

I think in both cases the app was built against the same version of SDL so maybe the newer version of g++ was more forgiving. I’m not really sure why it was seg faulting.

texture=0x8 looks suspicious. Using sanitizers (e.g. -fsanitize=address,undefined) or a memory debugging tool such as Valgrind can often help hunt down the root cause of this type of problem.

Thanks for pointing that bit out about the texture. I’ll check out these resources you have provided.