Source Code Project Mantis - FSSCP
View Issue Details
0003146FSSCPuser interfacepublic2015-02-26 21:502015-03-31 04:33
Assigned Tom_m 
Platformx64OSWindows 7OS Version
Product Version3.7.2 RC5 
Target VersionFixed in Version 
Summary0003146: Crash when pressing enter key in empty region of main hall
DescriptionNormally, when a main hall is being displayed, pressing the enter key selects whatever door the mouse cursor is hovering over. Of course, if the mouse cursor isn't pointing at a door, then nothing should happen when the enter key is pressed.

Starting at revision 10941, however, pressing the enter key while the cursor isn't hovering over a door produces this error message:

Region -1 doesn't have an action!
ntdll.dll! ZwWaitForSingleObject + 21 bytes
kernel32.dll! WaitForSingleObjectEx + 67 bytes
kernel32.dll! WaitForSingleObject + 18 bytes
fs2_open_3_7_1_SSE2-DEBUG.exe! SCP_DumpStack + 354 bytes
fs2_open_3_7_1_SSE2-DEBUG.exe! Error + 279 bytes
fs2_open_3_7_1_SSE2-DEBUG.exe! main_hall_do + 2038 bytes
fs2_open_3_7_1_SSE2-DEBUG.exe! game_do_state + 205 bytes
fs2_open_3_7_1_SSE2-DEBUG.exe! gameseq_process_events + 232 bytes
fs2_open_3_7_1_SSE2-DEBUG.exe! game_main + 782 bytes
fs2_open_3_7_1_SSE2-DEBUG.exe! WinMain + 328 bytes
fs2_open_3_7_1_SSE2-DEBUG.exe! __tmainCRTStartup + 296 bytes
fs2_open_3_7_1_SSE2-DEBUG.exe! WinMainCRTStartup + 13 bytes
kernel32.dll! BaseThreadInitThunk + 18 bytes
ntdll.dll! RtlInitializeExceptionChain + 99 bytes
ntdll.dll! RtlInitializeExceptionChain + 54 bytes

The error is being thrown from line 825 of mainhallmenu.cpp. Commenting out that line prevents the crash.
Steps To ReproduceJust load any main hall, move the mouse cursor away from the doors, and press enter. FSO will crash when you do.
TagsNo tags attached.
Attached Filespatch mainhallmenu.cpp.patch (567) 2015-03-25 08:21

2015-02-28 04:27   
Replacing line 825 of mainhallmenu.cpp with a break statement should fix this issue properly, as far as I can tell.
2015-03-25 08:21   
If a region actually doesn't have an action (which shouldn't be possible but it's better to be on the safe side) the error could still be reached.
If code is -1 nothing should be done, I have uploaded a patch that implements that behavior.
2015-03-31 04:25   
Patch works for me, and the code looks fine as well.
2015-03-31 04:33   
Fix committed to trunk@11296.

Issue History
2015-02-26 21:50YarnNew Issue
2015-02-27 06:53niffiwanStatusnew => confirmed
2015-02-28 04:27LotFNote Added: 0016519
2015-03-25 08:21m_mNote Added: 0016575
2015-03-25 08:21m_mFile Added: mainhallmenu.cpp.patch
2015-03-25 08:22m_mAssigned To => m_m
2015-03-25 08:22m_mStatusconfirmed => code review
2015-03-31 04:25niffiwanNote Added: 0016595
2015-03-31 04:33m_mChangeset attached => fs2open trunk r11296
2015-03-31 04:33m_mNote Added: 0016596
2015-03-31 04:33m_mStatuscode review => resolved
2015-03-31 04:33m_mResolutionopen => fixed