You've already forked godot
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:
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user