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 bfa2d0d0d9
commit b00aef8f29
2 changed files with 20 additions and 20 deletions

View File

@@ -62,23 +62,23 @@ class VisualScriptPropertySelector : public ConfirmationDialog {
SCOPE_ALL = SCOPE_BASE | SCOPE_INHERITERS | SCOPE_UNRELATED
};
LineEdit *search_box;
LineEdit *search_box = nullptr;
Button *case_sensitive_button;
Button *hierarchy_button;
Button *case_sensitive_button = nullptr;
Button *hierarchy_button = nullptr;
Button *search_visual_script_nodes;
Button *search_classes;
Button *search_operators;
Button *search_visual_script_nodes = nullptr;
Button *search_classes = nullptr;
Button *search_operators = nullptr;
Button *search_methods;
Button *search_signals;
Button *search_constants;
Button *search_properties;
Button *search_theme_items;
Button *search_methods = nullptr;
Button *search_signals = nullptr;
Button *search_constants = nullptr;
Button *search_properties = nullptr;
Button *search_theme_items = nullptr;
OptionButton *scope_combo;
Tree *results_tree;
OptionButton *scope_combo = nullptr;
Tree *results_tree = nullptr;
class SearchRunner;
Ref<SearchRunner> search_runner;
@@ -94,7 +94,7 @@ class VisualScriptPropertySelector : public ConfirmationDialog {
void _item_selected();
void _hide_requested();
EditorHelpBit *help_bit;
EditorHelpBit *help_bit = nullptr;
bool properties = false;
bool visual_script_generic = false;
@@ -104,9 +104,9 @@ class VisualScriptPropertySelector : public ConfirmationDialog {
String base_type;
String base_script;
ObjectID script;
Object *instance;
Object *instance = nullptr;
bool virtuals_only = false;
VBoxContainer *vbox;
VBoxContainer *vbox = nullptr;
protected:
void _notification(int p_what);
@@ -159,9 +159,9 @@ class VisualScriptPropertySelector::SearchRunner : public RefCounted {
}
};
VisualScriptPropertySelector *selector_ui;
Control *ui_service;
Tree *results_tree;
VisualScriptPropertySelector *selector_ui = nullptr;
Control *ui_service = nullptr;
Tree *results_tree = nullptr;
String term;
int search_flags;
int scope_flags;

View File

@@ -495,7 +495,7 @@ class VisualScriptLanguage : public ScriptLanguage {
String _debug_error;
int _debug_call_stack_pos = 0;
int _debug_max_call_stack;
CallLevel *_call_stack;
CallLevel *_call_stack = nullptr;
public:
StringName notification = "_notification";