You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When `mission_campaign_clear()` is called, all persistent SEXP nodes (those used by the campaign) are marked as non-persistent. When `sexp_shutdown()` was moved in #4503, this caused `Sexp_nodes` to be nullptr when the campaign was cleared, which caused a crash. This reorders the shutdown functions to prevent the crash.
Copy file name to clipboardExpand all lines: freespace2/freespace.cpp
+13-15Lines changed: 13 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -6684,19 +6684,6 @@ void game_shutdown(void)
6684
6684
gr_flip();
6685
6685
}
6686
6686
6687
-
// Free SEXP resources
6688
-
sexp_shutdown();
6689
-
6690
-
// Free the scripting resources of the new UI first
6691
-
scpui::shutdown_scripting();
6692
-
6693
-
// Everything after this should be done without scripting so we can free those resources here. By this point, all things that hold Lua References must be destroyed (such as Lua SEXPs)
6694
-
Script_system.Clear();
6695
-
6696
-
// Deinitialize the new UI system, needs to be done after scripting shutdown to make sure the resources were
6697
-
// released properly
6698
-
scpui::shutdown();
6699
-
6700
6687
// if the player has left the "player select" screen and quit the game without actually choosing
6701
6688
// a player, Player will be nullptr, in which case we shouldn't write the player file out!
6702
6689
if (!(Game_mode & GM_STANDALONE_SERVER) && (Player!=nullptr) && !Is_standalone){
@@ -6732,7 +6719,6 @@ void game_shutdown(void)
6732
6719
6733
6720
scoring_close();
6734
6721
6735
-
6736
6722
stars_close(); // clean out anything used by stars code
6737
6723
6738
6724
// the menu close functions will unload the bitmaps if they were displayed during the game
@@ -6742,6 +6728,19 @@ void game_shutdown(void)
6742
6728
// free left over memory from table parsing
6743
6729
player_tips_close();
6744
6730
6731
+
6732
+
// more fundamental shutdowns begin here ----------
6733
+
6734
+
sexp_shutdown(); // Free SEXP resources
6735
+
6736
+
scpui::shutdown_scripting(); // Free the scripting resources of the new UI first
6737
+
6738
+
Script_system.Clear(); // Everything after this should be done without scripting so we can free those resources here.
6739
+
// By this point, all things that hold Lua References must be destroyed (such as Lua SEXPs)
6740
+
6741
+
scpui::shutdown(); // Deinitialize the new UI system, needs to be done after scripting shutdown to make sure the resources were released properly
0 commit comments