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
Explicitly initialize stuff in ScenarioActivityConfigGUI
Undefined sanitizer's complaint:
../Source/Menus/ScenarioActivityConfigGUI.cpp:101:59: runtime error: load of value 190, which is not a valid value for type 'bool'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../Source/Menus/ScenarioActivityConfigGUI.cpp:101:59
...While working on this one, I discovered that C++
"default-initializes" class members, which leaves primitives and pointers
with undefined garbage values, but properly initializes classes.
And also the [Most vexing parse](https://en.wikipedia.org/wiki/Most_vexing_parse). Wow.
Copy file name to clipboardExpand all lines: Source/Menus/ScenarioActivityConfigGUI.h
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -65,16 +65,16 @@ namespace RTE {
65
65
66
66
GUIControlManager* m_GUIControlManager; //!< The GUIControlManager which holds all the GUIControls of this menu. Not owned by this.
67
67
68
-
const GameActivity* m_SelectedActivity; //!< The Activity this ScenarioActivityConfigGUI is configuring.
69
-
const GameActivity* m_PreviouslySelectedActivity; //!< The Activity this ScenarioActivityConfigGUI was configuring last, before it got was disabled.
70
-
Scene* m_SelectedScene; //!< The Scene the selected Activity will be using.
68
+
const GameActivity* m_SelectedActivity = nullptr; //!< The Activity this ScenarioActivityConfigGUI is configuring.
69
+
const GameActivity* m_PreviouslySelectedActivity = nullptr; //!< The Activity this ScenarioActivityConfigGUI was configuring last, before it got was disabled.
70
+
Scene* m_SelectedScene = nullptr; //!< The Scene the selected Activity will be using.
71
71
int m_LockedCPUTeam = Activity::Teams::NoTeam; //!< Which team the CPU is locked to, if any.
72
72
73
-
bool m_StartingGoldAdjustedManually; //!< Whether the player adjusted the starting gold, meaning it should stop automatically adjusting to the difficulty setting default starting gold where applicable.
73
+
bool m_StartingGoldAdjustedManually = false; //!< Whether the player adjusted the starting gold, meaning it should stop automatically adjusting to the difficulty setting default starting gold where applicable.
74
74
75
75
Timer m_StartGameButtonBlinkTimer; //!< Timer for blinking the start game button.
76
76
77
-
bool m_TechListFetched; //!< Whether the tech list was fetched and each team's ComboBox was populated with it, even if no valid tech modules were added.
77
+
bool m_TechListFetched = false; //!< Whether the tech list was fetched and each team's ComboBox was populated with it, even if no valid tech modules were added.
78
78
79
79
/// GUI elements that compose the Activity setup box.
0 commit comments