1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-05 17:15:09 +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

@@ -62,21 +62,21 @@ class GridMapEditor : public VBoxContainer {
DISPLAY_LIST
};
UndoRedo *undo_redo;
UndoRedo *undo_redo = nullptr;
InputAction input_action = INPUT_NONE;
Panel *panel;
MenuButton *options;
SpinBox *floor;
Panel *panel = nullptr;
MenuButton *options = nullptr;
SpinBox *floor = nullptr;
double accumulated_floor_delta = 0.0;
Button *mode_thumbnail;
Button *mode_list;
LineEdit *search_box;
HSlider *size_slider;
HBoxContainer *spatial_editor_hb;
ConfirmationDialog *settings_dialog;
VBoxContainer *settings_vbc;
SpinBox *settings_pick_distance;
Label *spin_box_label;
Button *mode_thumbnail = nullptr;
Button *mode_list = nullptr;
LineEdit *search_box = nullptr;
HSlider *size_slider = nullptr;
HBoxContainer *spatial_editor_hb = nullptr;
ConfirmationDialog *settings_dialog = nullptr;
VBoxContainer *settings_vbc = nullptr;
SpinBox *settings_pick_distance = nullptr;
Label *spin_box_label = nullptr;
struct SetItem {
Vector3i position;
@@ -89,7 +89,7 @@ class GridMapEditor : public VBoxContainer {
List<SetItem> set_items;
GridMap *node = nullptr;
MeshLibrary *last_mesh_library;
MeshLibrary *last_mesh_library = nullptr;
Transform3D grid_xform;
Transform3D edit_grid_xform;
@@ -173,15 +173,15 @@ class GridMapEditor : public VBoxContainer {
};
Node3DEditorPlugin *spatial_editor;
Node3DEditorPlugin *spatial_editor = nullptr;
struct AreaDisplay {
RID mesh;
RID instance;
};
ItemList *mesh_library_palette;
Label *info_message;
ItemList *mesh_library_palette = nullptr;
Label *info_message = nullptr;
void update_grid(); // Change which and where the grid is displayed
void _draw_grids(const Vector3 &cell_size);
@@ -234,7 +234,7 @@ public:
class GridMapEditorPlugin : public EditorPlugin {
GDCLASS(GridMapEditorPlugin, EditorPlugin);
GridMapEditor *grid_map_editor;
GridMapEditor *grid_map_editor = nullptr;
protected:
void _notification(int p_what);