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

@ -76,7 +76,7 @@ class DebugAdapterProtocol : public Object {
private:
static DebugAdapterProtocol *singleton;
DebugAdapterParser *parser;
DebugAdapterParser *parser = nullptr;
List<Ref<DAPeer>> clients;
Ref<TCPServer> server;

View file

@ -70,7 +70,7 @@ private:
ObjectID inspected_object_id;
Map<ObjectID, EditorDebuggerRemoteObject *> remote_objects;
Set<RES> remote_dependencies;
EditorDebuggerRemoteObject *variables;
EditorDebuggerRemoteObject *variables = nullptr;
void _object_selected(ObjectID p_object);
void _object_edited(ObjectID p_id, const String &p_prop, const Variant &p_value);

View file

@ -42,13 +42,13 @@ class EditorNetworkProfiler : public VBoxContainer {
GDCLASS(EditorNetworkProfiler, VBoxContainer)
private:
Button *activate;
Button *clear_button;
Tree *counters_display;
LineEdit *incoming_bandwidth_text;
LineEdit *outgoing_bandwidth_text;
Button *activate = nullptr;
Button *clear_button = nullptr;
Tree *counters_display = nullptr;
LineEdit *incoming_bandwidth_text = nullptr;
LineEdit *outgoing_bandwidth_text = nullptr;
Timer *frame_delay;
Timer *frame_delay = nullptr;
Map<ObjectID, SceneDebugger::RPCNodeInfo> nodes_data;

View file

@ -62,9 +62,9 @@ private:
OrderedHashMap<StringName, Monitor> monitors;
Map<StringName, TreeItem *> base_map;
Tree *monitor_tree;
Control *monitor_draw;
Label *info_message;
Tree *monitor_tree = nullptr;
Control *monitor_draw = nullptr;
Label *info_message = nullptr;
StringName marker_key;
int marker_frame;
const int MARGIN = 4;

View file

@ -90,20 +90,20 @@ public:
};
private:
Button *activate;
Button *clear_button;
TextureRect *graph;
Button *activate = nullptr;
Button *clear_button = nullptr;
TextureRect *graph = nullptr;
Ref<ImageTexture> graph_texture;
Vector<uint8_t> graph_image;
Tree *variables;
HSplitContainer *h_split;
Tree *variables = nullptr;
HSplitContainer *h_split = nullptr;
Set<StringName> plot_sigs;
OptionButton *display_mode;
OptionButton *display_time;
OptionButton *display_mode = nullptr;
OptionButton *display_time = nullptr;
SpinBox *cursor_metric_edit;
SpinBox *cursor_metric_edit = nullptr;
Vector<Metric> frame_metrics;
int total_metrics;
@ -119,8 +119,8 @@ private:
bool seeking;
Timer *frame_delay;
Timer *plot_delay;
Timer *frame_delay = nullptr;
Timer *plot_delay = nullptr;
void _update_frame();

View file

@ -67,20 +67,20 @@ public:
};
private:
Button *activate;
Button *clear_button;
Button *activate = nullptr;
Button *clear_button = nullptr;
TextureRect *graph;
TextureRect *graph = nullptr;
Ref<ImageTexture> graph_texture;
Vector<uint8_t> graph_image;
Tree *variables;
HSplitContainer *h_split;
CheckBox *frame_relative;
CheckBox *linked;
Tree *variables = nullptr;
HSplitContainer *h_split = nullptr;
CheckBox *frame_relative = nullptr;
CheckBox *linked = nullptr;
OptionButton *display_mode;
OptionButton *display_mode = nullptr;
SpinBox *cursor_metric_edit;
SpinBox *cursor_metric_edit = nullptr;
Vector<Metric> frame_metrics;
int last_metric;
@ -99,8 +99,8 @@ private:
bool seeking;
Timer *frame_delay;
Timer *plot_delay;
Timer *frame_delay = nullptr;
Timer *plot_delay = nullptr;
void _update_frame(bool p_focus_selected = false);

View file

@ -85,26 +85,26 @@ private:
ACTION_DELETE_ALL_BREAKPOINTS,
};
AcceptDialog *msgdialog;
AcceptDialog *msgdialog = nullptr;
LineEdit *clicked_ctrl;
LineEdit *clicked_ctrl_type;
LineEdit *live_edit_root;
Button *le_set;
Button *le_clear;
Button *export_csv;
LineEdit *clicked_ctrl = nullptr;
LineEdit *clicked_ctrl_type = nullptr;
LineEdit *live_edit_root = nullptr;
Button *le_set = nullptr;
Button *le_clear = nullptr;
Button *export_csv = nullptr;
VBoxContainer *errors_tab;
Tree *error_tree;
Button *expand_all_button;
Button *collapse_all_button;
Button *clear_button;
PopupMenu *item_menu;
VBoxContainer *errors_tab = nullptr;
Tree *error_tree = nullptr;
Button *expand_all_button = nullptr;
Button *collapse_all_button = nullptr;
Button *clear_button = nullptr;
PopupMenu *item_menu = nullptr;
Tree *breakpoints_tree;
PopupMenu *breakpoints_menu;
Tree *breakpoints_tree = nullptr;
PopupMenu *breakpoints_menu = nullptr;
EditorFileDialog *file_dialog;
EditorFileDialog *file_dialog = nullptr;
enum FileDialogPurpose {
SAVE_MONITORS_CSV,
SAVE_VRAM_CSV,
@ -117,31 +117,31 @@ private:
bool skip_breakpoints_value = false;
Ref<Script> stack_script;
TabContainer *tabs;
TabContainer *tabs = nullptr;
Label *reason;
Label *reason = nullptr;
Button *skip_breakpoints;
Button *copy;
Button *step;
Button *next;
Button *dobreak;
Button *docontinue;
Button *skip_breakpoints = nullptr;
Button *copy = nullptr;
Button *step = nullptr;
Button *next = nullptr;
Button *dobreak = nullptr;
Button *docontinue = nullptr;
// Reference to "Remote" tab in scene tree. Needed by _live_edit_set and buttons state.
// Each debugger should have it's tree in the future I guess.
const Tree *editor_remote_tree = nullptr;
Map<int, String> profiler_signature;
Tree *vmem_tree;
Button *vmem_refresh;
Button *vmem_export;
LineEdit *vmem_total;
Tree *vmem_tree = nullptr;
Button *vmem_refresh = nullptr;
Button *vmem_export = nullptr;
LineEdit *vmem_total = nullptr;
Tree *stack_dump;
Tree *stack_dump = nullptr;
LineEdit *search = nullptr;
EditorDebuggerInspector *inspector;
SceneDebuggerTree *scene_tree;
EditorDebuggerInspector *inspector = nullptr;
SceneDebuggerTree *scene_tree = nullptr;
Ref<RemoteDebuggerPeer> peer;
@ -149,10 +149,10 @@ private:
int last_path_id;
Map<String, int> res_path_cache;
EditorProfiler *profiler;
EditorVisualProfiler *visual_profiler;
EditorNetworkProfiler *network_profiler;
EditorPerformanceProfiler *performance_profiler;
EditorProfiler *profiler = nullptr;
EditorVisualProfiler *visual_profiler = nullptr;
EditorNetworkProfiler *network_profiler = nullptr;
EditorPerformanceProfiler *performance_profiler = nullptr;
OS::ProcessID remote_pid = 0;
bool breaked = false;