View Issue Details

IDProjectCategoryView StatusLast Update
0003146FSSCPuser interfacepublic2015-03-31 08:33
ReporterYarn Assigned Tom_m  
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
Platformx64OSWindows 7 
Product Version3.7.2 RC5 
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.

Activities

LotF

2015-02-28 09:27

reporter   ~0016519

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

m_m

2015-03-25 12:21

developer   ~0016575

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.

m_m

2015-03-25 12:21

developer  

mainhallmenu.cpp.patch (567 bytes)   
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;
mainhallmenu.cpp.patch (567 bytes)   

niffiwan

2015-03-31 08:25

developer   ~0016595

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

m_m

2015-03-31 08:33

developer   ~0016596

Fix committed to trunk@11296.

Related Changesets

fs2open: trunk r11296

2015-03-31 04:53

m_m


Ported: N/A

Details Diff
From LotF and me: Fix for Mantis 3146: Crash when pressing enter key in empty region of main hall Affected Issues
0003146
mod - /trunk/fs2_open/code/menuui/mainhallmenu.cpp Diff File

Issue History

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