fs2open.github.com icon indicating copy to clipboard operation
fs2open.github.com copied to clipboard

Rare Assert when clicking on a main hall option

Open Goober5000 opened this issue 1 year ago • 3 comments

Assert: "SCP_vector_inbounds(Sounds, idx)"
File: sound.cpp
Line: 1340
Attempt to get a sound that is not loaded, please report!

ntdll.dll! ZwWaitForSingleObject + 20 bytes
KERNELBASE.dll! WaitForSingleObjectEx + 142 bytes
fs2_open_23_3_0_x64_AVX2-DEBUG.exe! SCP_DumpStack + 382 bytes
fs2_open_23_3_0_x64_AVX2-DEBUG.exe! dump_stacktrace + 61 bytes
fs2_open_23_3_0_x64_AVX2-DEBUG.exe! os::dialogs::AssertMessage + 637 bytes
fs2_open_23_3_0_x64_AVX2-DEBUG.exe! snd_set_pos + 119 bytes
fs2_open_23_3_0_x64_AVX2-DEBUG.exe! main_hall_mouse_grab_region + 562 bytes
fs2_open_23_3_0_x64_AVX2-DEBUG.exe! main_hall_handle_mouse_location + 114 bytes
fs2_open_23_3_0_x64_AVX2-DEBUG.exe! main_hall_do + 2719 bytes
fs2_open_23_3_0_x64_AVX2-DEBUG.exe! game_do_state + 258 bytes
fs2_open_23_3_0_x64_AVX2-DEBUG.exe! gameseq_process_events + 250 bytes
fs2_open_23_3_0_x64_AVX2-DEBUG.exe! game_main + 724 bytes
fs2_open_23_3_0_x64_AVX2-DEBUG.exe! SDL_main + 359 bytes
fs2_open_23_3_0_x64_AVX2-DEBUG.exe! main_getcmdline + 245 bytes
fs2_open_23_3_0_x64_AVX2-DEBUG.exe! invoke_main + 50 bytes
fs2_open_23_3_0_x64_AVX2-DEBUG.exe! __scrt_common_main_seh + 302 bytes
fs2_open_23_3_0_x64_AVX2-DEBUG.exe! __scrt_common_main + 14 bytes
fs2_open_23_3_0_x64_AVX2-DEBUG.exe! WinMainCRTStartup + 14 bytes
KERNEL32.DLL! BaseThreadInitThunk + 29 bytes
ntdll.dll! RtlUserThreadStart + 40 bytes

This occurs on these lines in snd_set_pos:

	int idx = ds_get_sound_index(channel);
	Assertion(SCP_vector_inbounds(Sounds, idx), "Attempt to get a sound that is not loaded, please report!");

This happens in JAD 2.22 when clicking on the Exit button. I haven't experienced it in other mods or on other buttons in this mod. When the Assert occurs, snd_handle is 1920, val is 0.0, as_pct is 1, channel is 1, idx is 303, and the size of Sounds is also 303.

The crash is pretty rare. It has happened a few times while testing, but I have not found a reliable way to reproduce it.

Goober5000 avatar Dec 24 '23 22:12 Goober5000