1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +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

@@ -108,7 +108,7 @@ class DisplayServerX11 : public DisplayServer {
#endif
#if defined(DBUS_ENABLED)
FreeDesktopScreenSaver *screensaver;
FreeDesktopScreenSaver *screensaver = nullptr;
bool keep_screen_on = false;
#endif
@@ -168,7 +168,7 @@ class DisplayServerX11 : public DisplayServer {
String internal_clipboard_primary;
Window xdnd_source_window;
::Display *x11_display;
char *xmbstring;
char *xmbstring = nullptr;
int xmblen;
unsigned long last_timestamp;
::Time last_keyrelease_time;
@@ -249,7 +249,7 @@ class DisplayServerX11 : public DisplayServer {
typedef void (*xrr_free_monitors_t)(xrr_monitor_info *monitors);
xrr_get_monitors_t xrr_get_monitors;
xrr_free_monitors_t xrr_free_monitors;
void *xrandr_handle;
void *xrandr_handle = nullptr;
Bool xrandr_ext_ok;
struct Property {

View File

@@ -66,7 +66,7 @@ private:
struct GLDisplay {
GLDisplay() { context = nullptr; }
~GLDisplay();
GLManager_X11_Private *context;
GLManager_X11_Private *context = nullptr;
::Display *x11_display;
XVisualInfo x_vi;
XSetWindowAttributes x_swa;
@@ -82,7 +82,7 @@ private:
LocalVector<GLWindow> _windows;
LocalVector<GLDisplay> _displays;
GLWindow *_current_window;
GLWindow *_current_window = nullptr;
void _internal_set_current_window(GLWindow *p_win);

View File

@@ -63,7 +63,7 @@ class OS_LinuxBSD : public OS_Unix {
CrashHandler crash_handler;
MainLoop *main_loop;
MainLoop *main_loop = nullptr;
protected:
virtual void initialize() override;