From f8ab79e68af20e18e1d868b64d6dfd0c429bc554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 4 Apr 2022 15:06:57 +0200 Subject: [PATCH] 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. --- core/config/engine.h | 2 +- core/core_bind.h | 2 +- core/io/file_access.h | 2 +- core/io/file_access_pack.h | 6 +- core/io/ip.h | 2 +- core/io/resource_format_binary.h | 2 +- core/io/resource_uid.h | 2 +- core/io/udp_server.h | 2 +- core/math/bvh.h | 27 +-- core/math/dynamic_bvh.h | 7 +- core/math/expression.h | 2 +- core/math/octree.h | 37 ++- core/object/callable_method_pointer.h | 2 +- core/object/class_db.h | 4 +- core/object/message_queue.h | 4 +- core/object/object.h | 6 +- core/object/script_language.h | 4 +- core/os/memory.h | 6 +- core/os/os.h | 2 - core/os/pool_allocator.h | 8 +- core/string/string_name.h | 2 +- core/templates/command_queue_mt.h | 2 +- core/templates/map.h | 6 +- core/templates/oa_hash_map.h | 2 +- core/templates/safe_list.h | 8 +- core/templates/self_list.h | 2 +- core/templates/set.h | 4 +- core/templates/thread_work_pool.h | 2 +- drivers/gles3/rasterizer_canvas_gles3.h | 8 +- drivers/gles3/storage/material_storage.h | 4 +- drivers/gles3/storage/texture_storage.h | 10 +- drivers/unix/dir_access_unix.h | 2 +- editor/action_map_editor.h | 36 +-- editor/animation_bezier_editor.h | 4 +- editor/animation_track_editor.h | 120 +++++----- editor/code_editor.h | 60 ++--- editor/connections_dialog.h | 48 ++-- editor/create_dialog.h | 12 +- .../debug_adapter/debug_adapter_protocol.h | 2 +- editor/debugger/editor_debugger_inspector.h | 2 +- editor/debugger/editor_network_profiler.h | 12 +- editor/debugger/editor_performance_profiler.h | 6 +- editor/debugger/editor_profiler.h | 20 +- editor/debugger/editor_visual_profiler.h | 22 +- editor/debugger/script_editor_debugger.h | 70 +++--- editor/dependency_editor.h | 26 +-- editor/editor_about.h | 10 +- editor/editor_asset_installer.h | 6 +- editor/editor_audio_buses.h | 56 ++--- editor/editor_command_palette.h | 4 +- editor/editor_dir_dialog.h | 10 +- editor/editor_export.h | 2 +- editor/editor_feature_profile.h | 30 +-- editor/editor_file_dialog.h | 66 +++--- editor/editor_file_system.h | 6 +- editor/editor_help.h | 28 +-- editor/editor_help_search.h | 14 +- editor/editor_inspector.h | 56 ++--- editor/editor_layouts_dialog.h | 6 +- editor/editor_log.h | 16 +- editor/editor_node.h | 210 +++++++++--------- editor/editor_path.h | 10 +- editor/editor_plugin_settings.h | 8 +- editor/editor_properties.h | 84 +++---- editor/editor_properties_array_dict.h | 42 ++-- editor/editor_resource_picker.h | 6 +- editor/editor_run_script.h | 2 +- editor/editor_sectioned_inspector.h | 6 +- editor/editor_settings_dialog.h | 28 +-- editor/editor_spin_slider.h | 2 +- editor/editor_toaster.h | 8 +- editor/editor_zoom_widget.h | 6 +- editor/export_template_manager.h | 40 ++-- editor/fileserver/editor_file_server.h | 2 +- editor/filesystem_dock.h | 74 +++--- editor/find_in_files.h | 40 ++-- editor/groups_editor.h | 44 ++-- editor/import/dynamic_font_import_settings.h | 2 +- editor/import/scene_import_settings.h | 54 ++--- editor/import_defaults_editor.h | 10 +- editor/import_dock.h | 24 +- editor/inspector_dock.h | 40 ++-- editor/localization_editor.h | 24 +- editor/node_dock.h | 12 +- editor/plugin_config_dialog.h | 22 +- editor/plugins/abstract_polygon_2d_editor.h | 16 +- .../plugins/animation_blend_space_1d_editor.h | 46 ++-- .../plugins/animation_blend_space_2d_editor.h | 58 ++--- .../animation_blend_tree_editor_plugin.h | 18 +- .../plugins/animation_player_editor_plugin.h | 48 ++-- .../plugins/animation_state_machine_editor.h | 44 ++-- editor/plugins/animation_tree_editor_plugin.h | 12 +- editor/plugins/asset_library_editor_plugin.h | 94 ++++---- editor/plugins/audio_stream_editor_plugin.h | 2 +- editor/plugins/camera_3d_editor_plugin.h | 6 +- editor/plugins/canvas_item_editor_plugin.h | 116 +++++----- .../collision_polygon_2d_editor_plugin.h | 2 +- .../collision_shape_2d_editor_plugin.h | 8 +- editor/plugins/control_editor_plugin.h | 24 +- .../plugins/cpu_particles_2d_editor_plugin.h | 18 +- .../plugins/cpu_particles_3d_editor_plugin.h | 4 +- editor/plugins/curve_editor_plugin.h | 4 +- editor/plugins/debugger_editor_plugin.h | 6 +- .../plugins/gpu_particles_2d_editor_plugin.h | 22 +- .../plugins/gpu_particles_3d_editor_plugin.h | 24 +- ...pu_particles_collision_sdf_editor_plugin.h | 8 +- editor/plugins/gradient_editor_plugin.h | 6 +- editor/plugins/input_event_editor_plugin.h | 6 +- .../plugins/light_occluder_2d_editor_plugin.h | 2 +- editor/plugins/lightmap_gi_editor_plugin.h | 6 +- editor/plugins/line_2d_editor_plugin.h | 2 +- editor/plugins/mesh_editor_plugin.h | 16 +- .../plugins/mesh_instance_3d_editor_plugin.h | 16 +- editor/plugins/mesh_library_editor_plugin.h | 10 +- editor/plugins/multimesh_editor_plugin.h | 32 +-- .../navigation_polygon_editor_plugin.h | 2 +- editor/plugins/node_3d_editor_gizmos.h | 6 +- editor/plugins/node_3d_editor_plugin.h | 166 +++++++------- .../occluder_instance_3d_editor_plugin.h | 6 +- editor/plugins/ot_features_plugin.h | 2 +- editor/plugins/path_2d_editor_plugin.h | 26 +-- editor/plugins/path_3d_editor_plugin.h | 16 +- .../plugins/physical_bone_3d_editor_plugin.h | 4 +- editor/plugins/polygon_2d_editor_plugin.h | 42 ++-- editor/plugins/polygon_3d_editor_plugin.h | 18 +- editor/plugins/replication_editor_plugin.h | 4 +- .../resource_preloader_editor_plugin.h | 18 +- editor/plugins/root_motion_editor_plugin.h | 8 +- editor/plugins/script_editor_plugin.h | 88 ++++---- editor/plugins/shader_editor_plugin.h | 22 +- editor/plugins/shader_file_editor_plugin.h | 10 +- editor/plugins/skeleton_2d_editor_plugin.h | 8 +- editor/plugins/skeleton_3d_editor_plugin.h | 30 +-- editor/plugins/skeleton_ik_3d_editor_plugin.h | 4 +- editor/plugins/sprite_2d_editor_plugin.h | 22 +- editor/plugins/sprite_frames_editor_plugin.h | 68 +++--- editor/plugins/style_box_editor_plugin.h | 2 +- editor/plugins/text_control_editor_plugin.h | 2 +- editor/plugins/texture_3d_editor_plugin.h | 6 +- .../plugins/texture_layered_editor_plugin.h | 6 +- editor/plugins/texture_region_editor_plugin.h | 40 ++-- editor/plugins/theme_editor_plugin.h | 198 ++++++++--------- editor/plugins/theme_editor_preview.h | 16 +- editor/plugins/tiles/atlas_merging_dialog.h | 16 +- editor/plugins/tiles/tile_atlas_view.h | 36 +-- editor/plugins/tiles/tile_data_editors.h | 46 ++-- editor/plugins/tiles/tile_map_editor.h | 110 ++++----- .../tiles/tile_proxies_manager_dialog.h | 22 +- .../tiles/tile_set_atlas_source_editor.h | 70 +++--- editor/plugins/tiles/tile_set_editor.h | 32 +-- ...tile_set_scenes_collection_source_editor.h | 22 +- editor/plugins/tiles/tiles_editor_plugin.h | 8 +- .../plugins/version_control_editor_plugin.h | 74 +++--- editor/plugins/voxel_gi_editor_plugin.h | 8 +- editor/progress_dialog.h | 6 +- editor/project_export.h | 74 +++--- editor/project_settings_editor.h | 46 ++-- editor/property_editor.h | 38 ++-- editor/property_selector.h | 8 +- editor/quick_open.h | 4 +- editor/rename_dialog.h | 50 ++--- editor/reparent_dialog.h | 4 +- editor/scene_tree_dock.h | 72 +++--- editor/scene_tree_editor.h | 18 +- editor/script_create_dialog.h | 44 ++-- editor/shader_globals_editor.h | 10 +- modules/csg/csg_shape.h | 2 +- modules/gdscript/gdscript.h | 16 +- .../language_server/gdscript_text_document.h | 2 +- modules/gdscript/tests/gdscript_test_runner.h | 4 +- .../gridmap/editor/grid_map_editor_plugin.h | 36 +-- modules/mono/glue/arguments_vector.h | 2 +- modules/mono/managed_callable.h | 2 +- modules/mono/mono_gd/gd_mono.h | 18 +- modules/mono/mono_gd/gd_mono_assembly.h | 4 +- modules/mono/mono_gd/gd_mono_cache.h | 140 ++++++------ modules/mono/mono_gd/gd_mono_class.h | 6 +- modules/mono/mono_gd/gd_mono_field.h | 6 +- modules/mono/mono_gd/gd_mono_marshal.h | 10 +- modules/mono/mono_gd/gd_mono_method.h | 2 +- modules/mono/mono_gd/gd_mono_property.h | 6 +- modules/mono/mono_gd/gd_mono_wasm_m2n.h | 4 +- modules/mono/signal_awaiter_utils.h | 2 +- .../editor/navigation_mesh_editor_plugin.h | 14 +- modules/navigation/nav_utils.h | 2 +- modules/noise/noise.h | 2 +- modules/openxr/editor/openxr_editor_plugin.h | 2 +- .../extensions/openxr_extension_wrapper.h | 2 +- modules/raycast/raycast_occlusion_cull.h | 4 +- modules/regex/regex.h | 2 +- modules/theora/video_stream_theora.h | 2 +- .../editor/visual_script_property_selector.h | 38 ++-- modules/visual_script/visual_script.h | 2 +- platform/android/os_android.h | 8 +- platform/iphone/os_iphone.h | 6 +- platform/linuxbsd/display_server_x11.h | 6 +- platform/linuxbsd/gl_manager_x11.h | 4 +- platform/linuxbsd/os_linuxbsd.h | 2 +- platform/osx/joypad_osx.h | 2 +- platform/uwp/joypad_uwp.h | 2 +- platform/uwp/os_uwp.h | 10 +- platform/windows/display_server_windows.h | 2 +- platform/windows/gl_manager_windows.h | 2 +- platform/windows/joypad_windows.h | 4 +- platform/windows/os_windows.h | 4 +- scene/2d/physical_bone_2d.h | 2 +- scene/3d/skeleton_3d.h | 4 +- scene/gui/dialogs.h | 10 +- scene/gui/file_dialog.h | 44 ++-- scene/gui/gradient_edit.h | 4 +- scene/gui/graph_edit.h | 32 +-- scene/gui/item_list.h | 2 +- scene/gui/menu_button.h | 2 +- scene/gui/option_button.h | 2 +- scene/gui/popup.h | 2 +- scene/gui/popup_menu.h | 8 +- scene/gui/range.h | 2 +- scene/gui/scroll_container.h | 4 +- scene/gui/spin_box.h | 4 +- scene/gui/tab_container.h | 2 +- scene/gui/text_edit.h | 10 +- scene/gui/tree.h | 14 +- scene/main/http_request.h | 2 +- scene/main/scene_tree.h | 4 +- scene/multiplayer/scene_cache_interface.h | 2 +- .../multiplayer/scene_replication_interface.h | 2 +- scene/resources/skeleton_modification_2d.h | 2 +- scene/resources/skeleton_modification_3d.h | 2 +- servers/audio/audio_driver_dummy.h | 2 +- servers/audio/audio_filter_sw.h | 2 +- servers/audio/audio_rb_resampler.h | 4 +- .../effects/audio_effect_stereo_enhance.h | 2 +- .../audio/effects/audio_stream_generator.h | 2 +- servers/audio/effects/reverb.h | 2 +- servers/audio_server.h | 2 +- .../extensions/physics_server_3d_extension.h | 2 +- servers/physics_3d/godot_area_pair_3d.h | 12 +- servers/physics_3d/godot_physics_server_3d.h | 2 +- servers/physics_3d/godot_space_3d.h | 2 +- servers/rendering/renderer_canvas_cull.h | 2 +- servers/rendering/renderer_canvas_render.h | 36 +-- .../render_forward_clustered.h | 2 +- .../scene_shader_forward_clustered.h | 4 +- .../forward_mobile/render_forward_mobile.h | 2 +- .../scene_shader_forward_mobile.h | 4 +- .../rendering/renderer_rd/pipeline_cache_rd.h | 2 +- .../renderer_rd/renderer_canvas_render_rd.h | 6 +- .../renderer_rd/renderer_compositor_rd.h | 8 +- .../renderer_rd/renderer_scene_gi_rd.h | 10 +- .../renderer_rd/renderer_scene_render_rd.h | 24 +- .../renderer_rd/renderer_scene_sky_rd.h | 10 +- .../renderer_rd/storage_rd/material_storage.h | 8 +- .../renderer_rd/storage_rd/mesh_storage.h | 2 +- servers/rendering/renderer_scene_cull.h | 32 +-- servers/rendering/renderer_scene_render.h | 2 +- servers/rendering/renderer_viewport.h | 2 +- servers/rendering/shader_language.h | 14 +- tests/core/math/test_geometry_3d.h | 4 +- 258 files changed, 2398 insertions(+), 2421 deletions(-) diff --git a/core/config/engine.h b/core/config/engine.h index 1adab9b96f32..eac96852b30a 100644 --- a/core/config/engine.h +++ b/core/config/engine.h @@ -40,7 +40,7 @@ class Engine { public: struct Singleton { StringName name; - Object *ptr; + Object *ptr = nullptr; StringName class_name; //used for binding generation hinting bool user_created = false; Singleton(const StringName &p_name = StringName(), Object *p_ptr = nullptr, const StringName &p_class_name = StringName()); diff --git a/core/core_bind.h b/core/core_bind.h index 907f37c5faae..4d26698f9907 100644 --- a/core/core_bind.h +++ b/core/core_bind.h @@ -447,7 +447,7 @@ public: class Directory : public RefCounted { GDCLASS(Directory, RefCounted); - DirAccess *d; + DirAccess *d = nullptr; bool dir_open = false; bool include_navigational = false; diff --git a/core/io/file_access.h b/core/io/file_access.h index a6cb5d9fc660..a5150010da0e 100644 --- a/core/io/file_access.h +++ b/core/io/file_access.h @@ -183,7 +183,7 @@ struct FileAccessRef { operator bool() const { return f != nullptr; } - FileAccess *f; + FileAccess *f = nullptr; operator FileAccess *() { return f; } diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h index 6eee2f593d98..fe4b12aef6b3 100644 --- a/core/io/file_access_pack.h +++ b/core/io/file_access_pack.h @@ -64,7 +64,7 @@ public: uint64_t offset; //if offset is ZERO, the file was ERASED uint64_t size; uint8_t md5[16]; - PackSource *src; + PackSource *src = nullptr; bool encrypted; }; @@ -103,7 +103,7 @@ private: Vector sources; - PackedDir *root; + PackedDir *root = nullptr; static PackedData *singleton; bool disabled = false; @@ -150,7 +150,7 @@ class FileAccessPack : public FileAccess { mutable bool eof; uint64_t off; - FileAccess *f; + FileAccess *f = nullptr; virtual Error _open(const String &p_path, int p_mode_flags); virtual uint64_t _get_modified_time(const String &p_file) { return 0; } virtual uint32_t _get_unix_permissions(const String &p_file) { return 0; } diff --git a/core/io/ip.h b/core/io/ip.h index ebd944a94974..06ff8a4d70fa 100644 --- a/core/io/ip.h +++ b/core/io/ip.h @@ -62,7 +62,7 @@ public: typedef int ResolverID; private: - _IP_ResolverPrivate *resolver; + _IP_ResolverPrivate *resolver = nullptr; protected: static IP *singleton; diff --git a/core/io/resource_format_binary.h b/core/io/resource_format_binary.h index c80c9b0ac94a..5403168a5343 100644 --- a/core/io/resource_format_binary.h +++ b/core/io/resource_format_binary.h @@ -127,7 +127,7 @@ class ResourceFormatSaverBinaryInstance { bool skip_editor; bool big_endian; bool takeover_paths; - FileAccess *f; + FileAccess *f = nullptr; String magic; Set resource_set; diff --git a/core/io/resource_uid.h b/core/io/resource_uid.h index 1ea44b9d06ee..0b7ffdf6d0c7 100644 --- a/core/io/resource_uid.h +++ b/core/io/resource_uid.h @@ -46,7 +46,7 @@ public: static String get_cache_file(); private: - void *crypto; // CryptoCore::RandomGenerator (avoid including crypto_core.h) + void *crypto = nullptr; // CryptoCore::RandomGenerator (avoid including crypto_core.h) Mutex mutex; struct Cache { CharString cs; diff --git a/core/io/udp_server.h b/core/io/udp_server.h index 4a7546fddf2d..47f06b249025 100644 --- a/core/io/udp_server.h +++ b/core/io/udp_server.h @@ -43,7 +43,7 @@ protected: }; struct Peer { - PacketPeerUDP *peer; + PacketPeerUDP *peer = nullptr; IPAddress ip; uint16_t port = 0; diff --git a/core/math/bvh.h b/core/math/bvh.h index f429ce189b48..9f6ab9f7361f 100644 --- a/core/math/bvh.h +++ b/core/math/bvh.h @@ -763,19 +763,19 @@ private: tree._extra[p_handle.id()].last_updated_tick = 0; } - PairCallback pair_callback; - UnpairCallback unpair_callback; - CheckPairCallback check_pair_callback; - void *pair_callback_userdata; - void *unpair_callback_userdata; - void *check_pair_callback_userdata; + PairCallback pair_callback = nullptr; + UnpairCallback unpair_callback = nullptr; + CheckPairCallback check_pair_callback = nullptr; + void *pair_callback_userdata = nullptr; + void *unpair_callback_userdata = nullptr; + void *check_pair_callback_userdata = nullptr; BVHTREE_CLASS tree; // for collision pairing, // maintain a list of all items moved etc on each frame / tick LocalVector changed_items; - uint32_t _tick; + uint32_t _tick = 1; // Start from 1 so items with 0 indicate never updated. class BVHLockedFunction { public: @@ -801,23 +801,16 @@ private: } private: - Mutex *_mutex; + Mutex *_mutex = nullptr; }; Mutex _mutex; // local toggle for turning on and off thread safety in project settings - bool _thread_safe; + bool _thread_safe = BVH_THREAD_SAFE; public: - BVH_Manager() { - _tick = 1; // start from 1 so items with 0 indicate never updated - pair_callback = nullptr; - unpair_callback = nullptr; - pair_callback_userdata = nullptr; - unpair_callback_userdata = nullptr; - _thread_safe = BVH_THREAD_SAFE; - } + BVH_Manager() {} }; #undef BVHTREE_CLASS diff --git a/core/math/dynamic_bvh.h b/core/math/dynamic_bvh.h index 50ec2c2b304e..74831089f3bb 100644 --- a/core/math/dynamic_bvh.h +++ b/core/math/dynamic_bvh.h @@ -183,7 +183,7 @@ private: Node *parent = nullptr; union { Node *childs[2]; - void *data; + void *data = nullptr; }; _FORCE_INLINE_ bool is_leaf() const { return childs[1] == nullptr; } @@ -215,10 +215,7 @@ private: return axis.dot(volume.get_center() - org) <= 0; } - Node() { - childs[0] = nullptr; - childs[1] = nullptr; - } + Node() {} }; PagedAllocator node_allocator; diff --git a/core/math/expression.h b/core/math/expression.h index 9b87bdd6ec81..d43cc4091a5a 100644 --- a/core/math/expression.h +++ b/core/math/expression.h @@ -147,7 +147,7 @@ private: bool is_op = false; union { Variant::Operator op; - ENode *node; + ENode *node = nullptr; }; }; diff --git a/core/math/octree.h b/core/math/octree.h index e73f8213b340..65ab9e2292e5 100644 --- a/core/math/octree.h +++ b/core/math/octree.h @@ -134,7 +134,7 @@ private: List pair_list; struct OctantOwner { - Octant *octant; + Octant *octant = nullptr; typename List::Element *E; }; // an element can be in max 8 octants @@ -147,7 +147,7 @@ private: int refcount; bool intersect; Element *A, *B; - void *ud; + void *ud = nullptr; typename List::Element *eA, *eB; }; @@ -156,18 +156,18 @@ private: ElementMap element_map; PairMap pair_map; - PairCallback pair_callback; - UnpairCallback unpair_callback; - void *pair_callback_userdata; - void *unpair_callback_userdata; + PairCallback pair_callback = nullptr; + UnpairCallback unpair_callback = nullptr; + void *pair_callback_userdata = nullptr; + void *unpair_callback_userdata = nullptr; - OctreeElementID last_element_id; - uint64_t pass; + OctreeElementID last_element_id = 1; + uint64_t pass = 1; - real_t unit_size; - Octant *root; - int octant_count; - int pair_count; + real_t unit_size = 1.0; + Octant *root = nullptr; + int octant_count = 0; + int pair_count = 0; _FORCE_INLINE_ void _pair_check(PairData *p_pair) { bool intersect = p_pair->A->aabb.intersects_inclusive(p_pair->B->aabb); @@ -294,7 +294,7 @@ private: const Vector3 *points; int point_count; T **result_array; - int *result_idx; + int *result_idx = nullptr; int result_max; uint32_t mask; }; @@ -1265,18 +1265,7 @@ void Octree::set_unpair_callback(UnpairCallback p_callback, vo template Octree::Octree(real_t p_unit_size) { - last_element_id = 1; - pass = 1; unit_size = p_unit_size; - root = nullptr; - - octant_count = 0; - pair_count = 0; - - pair_callback = nullptr; - unpair_callback = nullptr; - pair_callback_userdata = nullptr; - unpair_callback_userdata = nullptr; } #endif // OCTREE_H diff --git a/core/object/callable_method_pointer.h b/core/object/callable_method_pointer.h index 3cd9ad381912..577d4b9fbdd0 100644 --- a/core/object/callable_method_pointer.h +++ b/core/object/callable_method_pointer.h @@ -38,7 +38,7 @@ #include "core/variant/callable.h" class CallableCustomMethodPointerBase : public CallableCustom { - uint32_t *comp_ptr; + uint32_t *comp_ptr = nullptr; uint32_t comp_size; uint32_t h; #ifdef DEBUG_METHODS_ENABLED diff --git a/core/object/class_db.h b/core/object/class_db.h index b8a4b3ea2ba8..5da85237430b 100644 --- a/core/object/class_db.h +++ b/core/object/class_db.h @@ -85,8 +85,8 @@ public: int index; StringName setter; StringName getter; - MethodBind *_setptr; - MethodBind *_getptr; + MethodBind *_setptr = nullptr; + MethodBind *_getptr = nullptr; Variant::Type type; }; diff --git a/core/object/message_queue.h b/core/object/message_queue.h index eaab01d0aa39..2219cdb8f687 100644 --- a/core/object/message_queue.h +++ b/core/object/message_queue.h @@ -62,10 +62,10 @@ class MessageQueue { }; }; - uint8_t *buffer; + uint8_t *buffer = nullptr; uint32_t buffer_end = 0; uint32_t buffer_max_used = 0; - uint32_t buffer_size; + uint32_t buffer_size = 0; void _call_function(const Callable &p_callable, const Variant *p_args, int p_argcount, bool p_show_error); diff --git a/core/object/object.h b/core/object/object.h index b640c4e78a7d..eeef03dcb9a7 100644 --- a/core/object/object.h +++ b/core/object/object.h @@ -538,8 +538,8 @@ private: std::mutex _instance_binding_mutex; struct InstanceBinding { - void *binding; - void *token; + void *binding = nullptr; + void *token = nullptr; GDNativeInstanceBindingFreeCallback free_callback = nullptr; GDNativeInstanceBindingReferenceCallback reference_callback = nullptr; }; @@ -849,7 +849,7 @@ class ObjectDB { uint64_t validator : OBJECTDB_VALIDATOR_BITS; uint64_t next_free : OBJECTDB_SLOT_MAX_COUNT_BITS; uint64_t is_ref_counted : 1; - Object *object; + Object *object = nullptr; }; static SpinLock spin_lock; diff --git a/core/object/script_language.h b/core/object/script_language.h index af4f276825f6..08b82d798eda 100644 --- a/core/object/script_language.h +++ b/core/object/script_language.h @@ -430,11 +430,11 @@ public: extern uint8_t script_encryption_key[32]; class PlaceHolderScriptInstance : public ScriptInstance { - Object *owner; + Object *owner = nullptr; List properties; Map values; Map constants; - ScriptLanguage *language; + ScriptLanguage *language = nullptr; Ref