Source Code Project Mantis - FSSCP
View Issue Details
0002983FSSCPgameplaypublic2013-12-20 23:092014-08-29 23:21
Reporterniffiwan 
Assigned Tokarajorma 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version3.7.1 
Target Version3.7.2Fixed in Version3.7.1 
Summary0002983: 'g' key to play last mission is broken
DescriptionNormally pressing "g" in the mainhall restarts the last mission played, skipping the briefing and going straight into the gameplay.

Now FSO crashes when "g" is pressed.
Steps To ReproduceStart FSO with a debug exec
Start a mission & exit straight away
Exit FSO (mandatory, if you just go back to the main hall there is no crash)
Restart FSO
Press "g" & FSO crashes
Additional InformationIssue was introduced by r10159.

$ git bisect good
ad1bef534422ea5dedfab5cf4bf96aeb8981384b is the first bad commit
commit ad1bef534422ea5dedfab5cf4bf96aeb8981384b
Author: Goober5000 <Goober5000@387891d4-d844-0410-90c0-e4c51a9137d3>
Date: Mon Nov 25 05:52:50 2013 +0000

    some things don't need to be re-inited every time you pause the game
    
    git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10159 387891d4-d844-0410-90c0-e4c51a9137d3


Looks like a null pointer dereference here:

Program received signal SIGSEGV, Segmentation fault.
0x00000000005540ff in hud_init_ballistic_index () at hud/hudtarget.cpp:1027
warning: Source file is more recent than executable.
(gdb) bt
# 0 0x00000000005540ff in hud_init_ballistic_index () at hud/hudtarget.cpp:1027
# 1 0x0000000000525218 in set_current_hud () at hud/hudparse.cpp:637
# 2 0x00000000004176f1 in game_enter_state (old_state=1, new_state=2) at freespace2/freespace.cpp:6083
# 3 0x00000000004bec5c in gameseq_set_state (new_state=2, override=1) at gamesequence/gamesequence.cpp:284
# 4 0x000000000041648d in game_process_event (current_state=1, event=2) at freespace2/freespace.cpp:5164
# 5 0x00000000004bf140 in gameseq_process_events () at gamesequence/gamesequence.cpp:399
# 6 0x0000000000418cd2 in game_main (cmdline=0x21e8360 "") at freespace2/freespace.cpp:7061
# 7 0x0000000000418ed2 in main (argc=1, argv=0x7fffffffe2b8) at freespace2/freespace.cpp:7195
(gdb) print Player_ship
$1 = (ship *) 0x0


1021? void hud_init_ballistic_index()
1022? {
1023? int i;
1024?
1025? // decide whether to realign HUD for ballistic primaries
1026? ballistic_hud_index = 0;
1027?> for (i = 0; i < Player_ship->weapons.num_primary_banks; i++)
TagsNo tags attached.
Attached Files

Notes
(0015524)
m_m   
2013-12-21 03:10   
I can't reproduce this crash on Windows, maybe it was fixed by a recent commit or this is an isolated issue of linux.
(0015525)
niffiwan   
2013-12-21 04:28   
(Last edited: 2013-12-21 05:00)
thanks for the info, I double checked the steps to reproduce using r10253 and the problem still occurs for me. This did let me clarify that I have to exit FSO for it to manifest, if I just go back to the mainhall without exiting it doesn't occur.

(kinda makes sense, presumably that pointer is set correctly the 1st time a mission loads normally)

edit: and it took a while, but just checked on my Windows slowtop and I was able to reproduce the problem using the latest nightly.

(0015526)
m_m   
2013-12-21 05:25   
Ok, restarting the game now also triggers this for me.
It looks like mission_load() is not called before we enter the gameplay state.
(0015527)
m_m   
2013-12-21 06:43   
Moving the lines added in revision r10159 down after the game_start_mission() call fixes this issue although there are still severe issues with being the the gameplay state when the loading a mission especially with scripting. We should probably introduce a new mission load state so fix all these issues.
(0015657)
niffiwan   
2014-03-14 00:42   
I think you may have fixed this in r10471?
(0015658)
karajorma   
2014-03-14 00:49   
I committed a change which prevents the game from crashing and (at least in the case of Diaspora) allows the g key to work. I'm not 100% certain it doesn't add issues itself.
(0015662)
karajorma   
2014-03-15 23:44   
Is this still causing anyone issues after I fixed it?
(0015663)
niffiwan   
2014-03-16 06:43   
It's worked OK for me for a few trivial test missions.
(0016251)
MageKing17   
2014-08-23 23:51   
Now that 'g' actually does something again (r11027), I can confirm that this issue appears to be resolved.

Issue History
2013-12-20 23:09niffiwanNew Issue
2013-12-20 23:18niffiwanAdditional Information Updatedbug_revision_view_page.php?rev_id=710#r710
2013-12-21 03:10m_mNote Added: 0015524
2013-12-21 04:26niffiwanSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=712#r712
2013-12-21 04:28niffiwanNote Added: 0015525
2013-12-21 05:00niffiwanNote Edited: 0015525bug_revision_view_page.php?bugnote_id=15525#r714
2013-12-21 05:25m_mNote Added: 0015526
2013-12-21 06:43m_mNote Added: 0015527
2014-03-14 00:42niffiwanAssigned To => karajorma
2014-03-14 00:42niffiwanStatusnew => assigned
2014-03-14 00:42niffiwanNote Added: 0015657
2014-03-14 00:49karajormaNote Added: 0015658
2014-03-15 23:44karajormaNote Added: 0015662
2014-03-16 06:43niffiwanNote Added: 0015663
2014-08-23 23:51MageKing17Note Added: 0016251
2014-08-29 23:21karajormaStatusassigned => resolved
2014-08-29 23:21karajormaFixed in Version => 3.7.1
2014-08-29 23:21karajormaResolutionopen => fixed