From 1fab644753443a525475740fc23172dedaa70d0e Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 27 Feb 2018 16:21:17 +0100 Subject: Use default member initialization for raw pointers Initialize to nullptr to prevent undefined behavior. Change-Id: I7753c0be77a886d62ecb1cd7b86fc8c98340b0b8 Reviewed-by: Paul Olav Tvete Reviewed-by: Shawn Rutledge --- src/client/qwaylandclipboard_p.h | 2 +- src/client/qwaylandcursor_p.h | 4 ++-- src/client/qwaylanddatadevice.cpp | 2 +- src/client/qwaylanddatadevicemanager_p.h | 2 +- src/client/qwaylanddataoffer_p.h | 4 ++-- src/client/qwaylanddatasource_p.h | 4 ++-- src/client/qwaylanddisplay_p.h | 12 ++++++------ src/client/qwaylanddnd_p.h | 2 +- src/client/qwaylandextendedsurface_p.h | 2 +- src/client/qwaylandinputcontext_p.h | 4 ++-- src/client/qwaylandinputdevice_p.h | 12 ++++++------ src/client/qwaylandnativeinterface_p.h | 2 +- src/client/qwaylandqtkey_p.h | 2 +- src/client/qwaylandshellsurface_p.h | 2 +- src/client/qwaylandsubsurface_p.h | 4 ++-- src/client/qwaylandtouch_p.h | 8 ++++---- src/client/qwaylandwindowmanagerintegration.cpp | 2 +- src/client/qwaylandwlshellsurface_p.h | 2 +- src/client/qwaylandxdgpopup_p.h | 2 +- src/client/qwaylandxdgshellv6_p.h | 8 ++++---- src/client/qwaylandxdgsurface_p.h | 4 ++-- src/client/shellintegration/qwaylandshellintegration_p.h | 2 +- 22 files changed, 44 insertions(+), 44 deletions(-) (limited to 'src/client') diff --git a/src/client/qwaylandclipboard_p.h b/src/client/qwaylandclipboard_p.h index 283362022..422022859 100644 --- a/src/client/qwaylandclipboard_p.h +++ b/src/client/qwaylandclipboard_p.h @@ -78,7 +78,7 @@ public: bool ownsMode(QClipboard::Mode mode) const override; private: - QWaylandDisplay *mDisplay; + QWaylandDisplay *mDisplay = nullptr; QMimeData m_emptyData; }; diff --git a/src/client/qwaylandcursor_p.h b/src/client/qwaylandcursor_p.h index 916a464e4..b7b1c2a75 100644 --- a/src/client/qwaylandcursor_p.h +++ b/src/client/qwaylandcursor_p.h @@ -119,8 +119,8 @@ private: struct wl_cursor* requestCursor(WaylandCursor shape); void initCursorMap(); - QWaylandDisplay *mDisplay; - struct wl_cursor_theme *mCursorTheme; + QWaylandDisplay *mDisplay = nullptr; + struct wl_cursor_theme *mCursorTheme = nullptr; QPoint mLastPos; QMap mCursors; QMultiMap mCursorNamesMap; diff --git a/src/client/qwaylanddatadevice.cpp b/src/client/qwaylanddatadevice.cpp index 4411ba65c..300c9de0a 100644 --- a/src/client/qwaylanddatadevice.cpp +++ b/src/client/qwaylanddatadevice.cpp @@ -203,7 +203,7 @@ void QWaylandDataDevice::data_device_motion(uint32_t time, wl_fixed_t x, wl_fixe m_dragPoint = calculateDragPosition(x, y, m_dragWindow); - QMimeData *dragData; + QMimeData *dragData = nullptr; Qt::DropActions supportedActions; if (drag) { dragData = drag->mimeData(); diff --git a/src/client/qwaylanddatadevicemanager_p.h b/src/client/qwaylanddatadevicemanager_p.h index 3daf780aa..10df1bca9 100644 --- a/src/client/qwaylanddatadevicemanager_p.h +++ b/src/client/qwaylanddatadevicemanager_p.h @@ -76,7 +76,7 @@ public: QWaylandDisplay *display() const; private: - QWaylandDisplay *m_display; + QWaylandDisplay *m_display = nullptr; }; } diff --git a/src/client/qwaylanddataoffer_p.h b/src/client/qwaylanddataoffer_p.h index c9b9c21f1..932506bf5 100644 --- a/src/client/qwaylanddataoffer_p.h +++ b/src/client/qwaylanddataoffer_p.h @@ -98,8 +98,8 @@ protected: private: int readData(int fd, QByteArray &data) const; - mutable QWaylandDataOffer *m_dataOffer; - QWaylandDisplay *m_display; + mutable QWaylandDataOffer *m_dataOffer = nullptr; + QWaylandDisplay *m_display = nullptr; mutable QStringList m_types; mutable QHash m_data; }; diff --git a/src/client/qwaylanddatasource_p.h b/src/client/qwaylanddatasource_p.h index bba003f56..a79cdcbfa 100644 --- a/src/client/qwaylanddatasource_p.h +++ b/src/client/qwaylanddatasource_p.h @@ -86,8 +86,8 @@ protected: void data_source_target(const QString &mime_type) override; private: - QWaylandDisplay *m_display; - QMimeData *m_mime_data; + QWaylandDisplay *m_display = nullptr; + QMimeData *m_mime_data = nullptr; }; } diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h index 0a7ea427a..dbcc2112f 100644 --- a/src/client/qwaylanddisplay_p.h +++ b/src/client/qwaylanddisplay_p.h @@ -149,7 +149,7 @@ public: uint32_t id; QString interface; uint32_t version; - struct ::wl_registry *registry; + struct ::wl_registry *registry = nullptr; RegistryGlobal(uint32_t id_, const QString &interface_, uint32_t version_, struct ::wl_registry *registry_) : id(id_), interface(interface_), version(version_), registry(registry_) { } }; @@ -191,17 +191,17 @@ private: void requestWaylandSync(); struct Listener { - RegistryListener listener; - void *data; + RegistryListener listener = nullptr; + void *data = nullptr; }; - struct wl_display *mDisplay; + struct wl_display *mDisplay = nullptr; QtWayland::wl_compositor mCompositor; QScopedPointer mShm; QList mScreens; QList mInputDevices; QList mRegistryListeners; - QWaylandIntegration *mWaylandIntegration; + QWaylandIntegration *mWaylandIntegration = nullptr; #if QT_CONFIG(wayland_datadevice) QScopedPointer mDndSelectionHandler; #endif @@ -212,7 +212,7 @@ private: QScopedPointer mWindowManagerIntegration; QScopedPointer mTextInputManager; QScopedPointer mHardwareIntegration; - QSocketNotifier *mReadNotifier; + QSocketNotifier *mReadNotifier = nullptr; int mFd; int mWritableNotificationFd; QList mGlobals; diff --git a/src/client/qwaylanddnd_p.h b/src/client/qwaylanddnd_p.h index 8a1d7f1f1..0f14eb00b 100644 --- a/src/client/qwaylanddnd_p.h +++ b/src/client/qwaylanddnd_p.h @@ -84,7 +84,7 @@ protected: private: - QWaylandDisplay *m_display; + QWaylandDisplay *m_display = nullptr; }; #endif } diff --git a/src/client/qwaylandextendedsurface_p.h b/src/client/qwaylandextendedsurface_p.h index 02700b290..dffd04281 100644 --- a/src/client/qwaylandextendedsurface_p.h +++ b/src/client/qwaylandextendedsurface_p.h @@ -83,7 +83,7 @@ private: void extended_surface_set_generic_property(const QString &name, wl_array *value) override; void extended_surface_close() override; - QWaylandWindow *m_window; + QWaylandWindow *m_window = nullptr; QVariantMap m_properties; }; diff --git a/src/client/qwaylandinputcontext_p.h b/src/client/qwaylandinputcontext_p.h index a554f2301..cbb2e18dc 100644 --- a/src/client/qwaylandinputcontext_p.h +++ b/src/client/qwaylandinputcontext_p.h @@ -107,7 +107,7 @@ protected: private: Qt::KeyboardModifiers modifiersToQtModifiers(uint32_t modifiers); - QWaylandDisplay *m_display; + QWaylandDisplay *m_display = nullptr; QWaylandInputMethodEventBuilder m_builder; QVector m_modifiersMap; @@ -155,7 +155,7 @@ public: private: QWaylandTextInput *textInput() const; - QWaylandDisplay *mDisplay; + QWaylandDisplay *mDisplay = nullptr; QPointer mCurrentWindow; }; diff --git a/src/client/qwaylandinputdevice_p.h b/src/client/qwaylandinputdevice_p.h index 8a02769e3..2c7d2cffd 100644 --- a/src/client/qwaylandinputdevice_p.h +++ b/src/client/qwaylandinputdevice_p.h @@ -143,13 +143,13 @@ public: private: void setCursor(Qt::CursorShape cursor, QWaylandScreen *screen); - QWaylandDisplay *mQDisplay; - struct wl_display *mDisplay; + QWaylandDisplay *mQDisplay = nullptr; + struct wl_display *mDisplay = nullptr; int mVersion; uint32_t mCaps = 0; - struct wl_surface *pointerSurface; + struct wl_surface *pointerSurface = nullptr; #if QT_CONFIG(wayland_datadevice) QWaylandDataDevice *mDataDevice = nullptr; @@ -207,7 +207,7 @@ public: uint32_t mods_locked, uint32_t group) override; - QWaylandInputDevice *mParent; + QWaylandInputDevice *mParent = nullptr; QPointer mFocus; #if QT_CONFIG(xkbcommon_evdev) xkb_context *mXkbContext = nullptr; @@ -262,7 +262,7 @@ public: void releaseButtons(); - QWaylandInputDevice *mParent; + QWaylandInputDevice *mParent = nullptr; QPointer mFocus; uint32_t mEnterSerial = 0; #if QT_CONFIG(cursor) @@ -302,7 +302,7 @@ public: bool allTouchPointsReleased(); void releasePoints(); - QWaylandInputDevice *mParent; + QWaylandInputDevice *mParent = nullptr; QPointer mFocus; QList mTouchPoints; QList mPrevTouchPoints; diff --git a/src/client/qwaylandnativeinterface_p.h b/src/client/qwaylandnativeinterface_p.h index c83180c09..3de80eb6a 100644 --- a/src/client/qwaylandnativeinterface_p.h +++ b/src/client/qwaylandnativeinterface_p.h @@ -85,7 +85,7 @@ public: QFunctionPointer platformFunction(const QByteArray &resource) const override; private: - QWaylandIntegration *m_integration; + QWaylandIntegration *m_integration = nullptr; QHash m_windowProperties; static void setSync(QWindow *window); diff --git a/src/client/qwaylandqtkey_p.h b/src/client/qwaylandqtkey_p.h index 3374b907a..9091cf819 100644 --- a/src/client/qwaylandqtkey_p.h +++ b/src/client/qwaylandqtkey_p.h @@ -68,7 +68,7 @@ public: QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_t id); private: - QWaylandDisplay *m_display; + QWaylandDisplay *m_display = nullptr; void key_extension_qtkey(struct wl_surface *surface, uint32_t time, diff --git a/src/client/qwaylandshellsurface_p.h b/src/client/qwaylandshellsurface_p.h index 06d92ba08..3a725d822 100644 --- a/src/client/qwaylandshellsurface_p.h +++ b/src/client/qwaylandshellsurface_p.h @@ -104,7 +104,7 @@ protected: virtual void setMinimized() {} private: - QWaylandWindow *m_window; + QWaylandWindow *m_window = nullptr; friend class QWaylandWindow; }; diff --git a/src/client/qwaylandsubsurface_p.h b/src/client/qwaylandsubsurface_p.h index 36a92a755..a9fd76a88 100644 --- a/src/client/qwaylandsubsurface_p.h +++ b/src/client/qwaylandsubsurface_p.h @@ -86,8 +86,8 @@ private: // to keep track of the sync state void set_sync(); void set_desync(); - QWaylandWindow *m_window; - QWaylandWindow *m_parent; + QWaylandWindow *m_window = nullptr; + QWaylandWindow *m_parent = nullptr; bool m_synchronized = false; QMutex m_syncLock; diff --git a/src/client/qwaylandtouch_p.h b/src/client/qwaylandtouch_p.h index 7d909769d..93a829e21 100644 --- a/src/client/qwaylandtouch_p.h +++ b/src/client/qwaylandtouch_p.h @@ -73,7 +73,7 @@ public: private: void registerDevice(int caps); - QWaylandDisplay *mDisplay; + QWaylandDisplay *mDisplay = nullptr; void touch_extension_touch(uint32_t time, uint32_t id, @@ -95,15 +95,15 @@ private: QList mTouchPoints; QList mPrevTouchPoints; - QTouchDevice *mTouchDevice; + QTouchDevice *mTouchDevice = nullptr; uint32_t mTimestamp; int mPointsLeft; uint32_t mFlags; int mMouseSourceId; QPointF mLastMouseLocal; QPointF mLastMouseGlobal; - QWindow *mTargetWindow; - QWaylandInputDevice *mInputDevice; + QWindow *mTargetWindow = nullptr; + QWaylandInputDevice *mInputDevice = nullptr; }; } diff --git a/src/client/qwaylandwindowmanagerintegration.cpp b/src/client/qwaylandwindowmanagerintegration.cpp index 785a0a44d..17ae8a5ae 100644 --- a/src/client/qwaylandwindowmanagerintegration.cpp +++ b/src/client/qwaylandwindowmanagerintegration.cpp @@ -61,7 +61,7 @@ class QWaylandWindowManagerIntegrationPrivate { public: QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay); bool m_blockPropertyUpdates = false; - QWaylandDisplay *m_waylandDisplay; + QWaylandDisplay *m_waylandDisplay = nullptr; QHash m_queuedProperties; bool m_showIsFullScreen = false; }; diff --git a/src/client/qwaylandwlshellsurface_p.h b/src/client/qwaylandwlshellsurface_p.h index 708c6f113..b0e677951 100644 --- a/src/client/qwaylandwlshellsurface_p.h +++ b/src/client/qwaylandwlshellsurface_p.h @@ -104,7 +104,7 @@ private: void updateTransientParent(QWindow *parent); void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, uint serial); - QWaylandWindow *m_window; + QWaylandWindow *m_window = nullptr; bool m_maximized = false; bool m_fullscreen = false; QSize m_size; diff --git a/src/client/qwaylandxdgpopup_p.h b/src/client/qwaylandxdgpopup_p.h index 85bd589bf..74c0dca26 100644 --- a/src/client/qwaylandxdgpopup_p.h +++ b/src/client/qwaylandxdgpopup_p.h @@ -81,7 +81,7 @@ protected: private: QWaylandExtendedSurface *m_extendedWindow = nullptr; - QWaylandWindow *m_window; + QWaylandWindow *m_window = nullptr; }; QT_END_NAMESPACE diff --git a/src/client/qwaylandxdgshellv6_p.h b/src/client/qwaylandxdgshellv6_p.h index 122beed0c..e59a67d69 100644 --- a/src/client/qwaylandxdgshellv6_p.h +++ b/src/client/qwaylandxdgshellv6_p.h @@ -106,7 +106,7 @@ private: QVarLengthArray states; } m_configureState; - QWaylandXdgSurfaceV6 *m_xdgSurface; + QWaylandXdgSurfaceV6 *m_xdgSurface = nullptr; }; class Popup : public QtWayland::zxdg_popup_v6 { @@ -117,14 +117,14 @@ private: void applyConfigure(); void zxdg_popup_v6_popup_done() override; - QWaylandXdgSurfaceV6 *m_xdgSurface; + QWaylandXdgSurfaceV6 *m_xdgSurface = nullptr; }; void setToplevel(); void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial, bool grab); - QWaylandXdgShellV6 *m_shell; - QWaylandWindow *m_window; + QWaylandXdgShellV6 *m_shell = nullptr; + QWaylandWindow *m_window = nullptr; Toplevel *m_toplevel = nullptr; Popup *m_popup = nullptr; bool m_configured = false; diff --git a/src/client/qwaylandxdgsurface_p.h b/src/client/qwaylandxdgsurface_p.h index fa7963206..42846c665 100644 --- a/src/client/qwaylandxdgsurface_p.h +++ b/src/client/qwaylandxdgsurface_p.h @@ -110,8 +110,8 @@ private: void updateTransientParent(QWaylandWindow *parent); private: - QWaylandWindow *m_window; - QWaylandXdgShell* m_shell; + QWaylandWindow *m_window = nullptr; + QWaylandXdgShell* m_shell = nullptr; bool m_maximized = false; bool m_minimized = false; bool m_fullscreen = false; diff --git a/src/client/shellintegration/qwaylandshellintegration_p.h b/src/client/shellintegration/qwaylandshellintegration_p.h index ab9b736bb..7f3a2cefc 100644 --- a/src/client/shellintegration/qwaylandshellintegration_p.h +++ b/src/client/shellintegration/qwaylandshellintegration_p.h @@ -81,7 +81,7 @@ public: } protected: - QWaylandDisplay *m_display; + QWaylandDisplay *m_display = nullptr; }; } -- cgit v1.2.3