2018-08-19 08:51 EDT


View Issue Details Jump to Notes ] Related Changesets ]
IDProjectCategoryView StatusLast Update
0003146FSSCPuser interfacepublic2015-03-31 04:33
ReporterYarn 
Assigned Tom_m 
PrioritynormalSeveritycrashReproducibilityalways
StatusresolvedResolutionfixed 
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 Files
  • patch file icon mainhallmenu.cpp.patch (567 bytes) 2015-03-25 08:21 -
    Index: code/menuui/mainhallmenu.cpp
    ===================================================================
    --- code/menuui/mainhallmenu.cpp	(revision 11289)
    +++ code/menuui/mainhallmenu.cpp	(working copy)
    @@ -814,6 +814,11 @@
     			if (code == ESC_PRESSED) {
     				region_action = ESC_PRESSED;
     			} else {
    +				if (code == -1) {
    +					// User didn't click on a valid button, just ignore the event
    +					break;
    +				}
    +
     				for (it = Main_hall->regions.begin(); Main_hall->regions.end() != it; ++it) {
     					if (it->mask == code) {
     						region_action = it->action;
    
    patch file icon mainhallmenu.cpp.patch (567 bytes) 2015-03-25 08:21 +

-Relationships
+Relationships

-Notes

~0016519

LotF (reporter)

Replacing line 825 of mainhallmenu.cpp with a break statement should fix this issue properly, as far as I can tell.

~0016575

m_m (developer)

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.

~0016595

niffiwan (developer)

Patch works for me, and the code looks fine as well.

~0016596

m_m (developer)

Fix committed to trunk@11296.
+Notes

+Related Changesets

-Issue History
Date Modified Username Field Change
2015-02-26 21:50 Yarn New Issue
2015-02-27 06:53 niffiwan Status new => confirmed
2015-02-28 04:27 LotF Note Added: 0016519
2015-03-25 08:21 m_m Note Added: 0016575
2015-03-25 08:21 m_m File Added: mainhallmenu.cpp.patch
2015-03-25 08:22 m_m Assigned To => m_m
2015-03-25 08:22 m_m Status confirmed => code review
2015-03-31 04:25 niffiwan Note Added: 0016595
2015-03-31 04:33 m_m Changeset attached => fs2open trunk r11296
2015-03-31 04:33 m_m Note Added: 0016596
2015-03-31 04:33 m_m Status code review => resolved
2015-03-31 04:33 m_m Resolution open => fixed
+Issue History