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

@@ -42,10 +42,10 @@ class EditorFileSystemDirectory;
class DependencyEditor : public AcceptDialog {
GDCLASS(DependencyEditor, AcceptDialog);
Tree *tree;
Button *fixdeps;
Tree *tree = nullptr;
Button *fixdeps = nullptr;
EditorFileDialog *search;
EditorFileDialog *search = nullptr;
String replacing;
String editing;
@@ -71,8 +71,8 @@ public:
class DependencyEditorOwners : public AcceptDialog {
GDCLASS(DependencyEditorOwners, AcceptDialog);
ItemList *owners;
PopupMenu *file_options;
ItemList *owners = nullptr;
PopupMenu *file_options = nullptr;
String editing;
void _fill_owners(EditorFileSystemDirectory *efsd);
@@ -95,8 +95,8 @@ public:
class DependencyRemoveDialog : public ConfirmationDialog {
GDCLASS(DependencyRemoveDialog, ConfirmationDialog);
Label *text;
Tree *owners;
Label *text = nullptr;
Tree *owners = nullptr;
Map<String, String> all_remove_files;
Vector<String> dirs_to_delete;
@@ -142,9 +142,9 @@ public:
private:
String for_file;
Mode mode;
Button *fdep;
Label *text;
Tree *files;
Button *fdep = nullptr;
Label *text = nullptr;
Tree *files = nullptr;
void ok_pressed() override;
void custom_action(const String &) override;
@@ -156,9 +156,9 @@ public:
class OrphanResourcesDialog : public ConfirmationDialog {
GDCLASS(OrphanResourcesDialog, ConfirmationDialog);
DependencyEditor *dep_edit;
Tree *files;
ConfirmationDialog *delete_confirm;
DependencyEditor *dep_edit = nullptr;
Tree *files = nullptr;
ConfirmationDialog *delete_confirm = nullptr;
void ok_pressed() override;
bool _fill_owners(EditorFileSystemDirectory *efsd, HashMap<String, int> &refs, TreeItem *p_parent);