1
0
mirror of https://github.com/godotengine/godot.git synced 2026-01-05 19:31:35 +00:00

Zero initialize all pointer class and struct members

This prevents the pitfall of UB when checking if they have been
assigned something valid by comparing to nullptr.
This commit is contained in:
Rémi Verschelde
2022-04-04 15:06:57 +02:00
parent 53317bbe14
commit f8ab79e68a
258 changed files with 2398 additions and 2421 deletions

View File

@@ -70,7 +70,7 @@ public:
class EditorPropertyAnchorsPreset : public EditorProperty {
GDCLASS(EditorPropertyAnchorsPreset, EditorProperty);
OptionButton *options;
OptionButton *options = nullptr;
void _option_selected(int p_which);
@@ -94,9 +94,9 @@ class EditorPropertySizeFlags : public EditorProperty {
SIZE_FLAGS_PRESET_CUSTOM,
};
OptionButton *flag_presets;
CheckBox *flag_expand;
VBoxContainer *flag_options;
OptionButton *flag_presets = nullptr;
CheckBox *flag_expand = nullptr;
VBoxContainer *flag_options = nullptr;
Vector<CheckBox *> flag_checks;
bool vertical = false;
@@ -128,8 +128,8 @@ public:
class ControlEditorToolbar : public HBoxContainer {
GDCLASS(ControlEditorToolbar, HBoxContainer);
UndoRedo *undo_redo;
EditorSelection *editor_selection;
UndoRedo *undo_redo = nullptr;
EditorSelection *editor_selection = nullptr;
enum MenuOption {
ANCHORS_AND_OFFSETS_PRESET_TOP_LEFT,
@@ -198,12 +198,12 @@ class ControlEditorToolbar : public HBoxContainer {
CONTAINERS_V_PRESET_SHRINK_END,
};
MenuButton *anchor_presets_menu;
PopupMenu *anchors_popup;
MenuButton *container_h_presets_menu;
MenuButton *container_v_presets_menu;
MenuButton *anchor_presets_menu = nullptr;
PopupMenu *anchors_popup = nullptr;
MenuButton *container_h_presets_menu = nullptr;
MenuButton *container_v_presets_menu = nullptr;
Button *anchor_mode_button;
Button *anchor_mode_button = nullptr;
bool anchors_mode = false;
@@ -239,7 +239,7 @@ public:
class ControlEditorPlugin : public EditorPlugin {
GDCLASS(ControlEditorPlugin, EditorPlugin);
ControlEditorToolbar *toolbar;
ControlEditorToolbar *toolbar = nullptr;
public:
virtual String get_name() const override { return "Control"; }