1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-21 14:57: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

@@ -46,8 +46,8 @@ class AnimationPlayerEditorPlugin;
class AnimationPlayerEditor : public VBoxContainer {
GDCLASS(AnimationPlayerEditor, VBoxContainer);
AnimationPlayerEditorPlugin *plugin;
AnimationPlayer *player;
AnimationPlayerEditorPlugin *plugin = nullptr;
AnimationPlayer *player = nullptr;
enum {
TOOL_NEW_ANIM,
@@ -88,31 +88,31 @@ class AnimationPlayerEditor : public VBoxContainer {
RESOURCE_SAVE
};
OptionButton *animation;
Button *stop;
Button *play;
Button *play_from;
Button *play_bw;
Button *play_bw_from;
Button *autoplay;
OptionButton *animation = nullptr;
Button *stop = nullptr;
Button *play = nullptr;
Button *play_from = nullptr;
Button *play_bw = nullptr;
Button *play_bw_from = nullptr;
Button *autoplay = nullptr;
MenuButton *tool_anim;
Button *onion_toggle;
MenuButton *onion_skinning;
Button *pin;
SpinBox *frame;
LineEdit *scale;
LineEdit *name;
Label *name_title;
UndoRedo *undo_redo;
MenuButton *tool_anim = nullptr;
Button *onion_toggle = nullptr;
MenuButton *onion_skinning = nullptr;
Button *pin = nullptr;
SpinBox *frame = nullptr;
LineEdit *scale = nullptr;
LineEdit *name = nullptr;
Label *name_title = nullptr;
UndoRedo *undo_redo = nullptr;
Ref<Texture2D> autoplay_icon;
Ref<Texture2D> reset_icon;
Ref<ImageTexture> autoplay_reset_icon;
bool last_active;
float timeline_position;
EditorFileDialog *file;
ConfirmationDialog *delete_dialog;
EditorFileDialog *file = nullptr;
ConfirmationDialog *delete_dialog = nullptr;
struct BlendEditor {
AcceptDialog *dialog = nullptr;
@@ -121,14 +121,14 @@ class AnimationPlayerEditor : public VBoxContainer {
} blend_editor;
ConfirmationDialog *name_dialog;
ConfirmationDialog *error_dialog;
ConfirmationDialog *name_dialog = nullptr;
ConfirmationDialog *error_dialog = nullptr;
int name_dialog_op = TOOL_NEW_ANIM;
bool updating;
bool updating_blends;
AnimationTrackEditor *track_editor;
AnimationTrackEditor *track_editor = nullptr;
static AnimationPlayerEditor *singleton;
// Onion skinning.
@@ -250,7 +250,7 @@ public:
class AnimationPlayerEditorPlugin : public EditorPlugin {
GDCLASS(AnimationPlayerEditorPlugin, EditorPlugin);
AnimationPlayerEditor *anim_editor;
AnimationPlayerEditor *anim_editor = nullptr;
protected:
void _notification(int p_what);