diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2018-02-27 16:21:17 +0100 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2018-02-28 10:51:35 +0000 |
commit | 1fab644753443a525475740fc23172dedaa70d0e (patch) | |
tree | bca0a88662679acd150172f5a73f64d1604960cf /tests | |
parent | c4bd9198b4a0fac809903dd2c09276c2c3c1b22e (diff) |
Use default member initialization for raw pointers
Initialize to nullptr to prevent undefined behavior.
Change-Id: I7753c0be77a886d62ecb1cd7b86fc8c98340b0b8
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/client/client/tst_client.cpp | 2 | ||||
-rw-r--r-- | tests/auto/client/shared/mockcompositor.h | 6 | ||||
-rw-r--r-- | tests/auto/client/shared/mockinput.h | 12 | ||||
-rw-r--r-- | tests/auto/client/shared/mocksurface.h | 2 | ||||
-rw-r--r-- | tests/auto/client/xdgshellv6/tst_xdgshellv6.cpp | 2 | ||||
-rw-r--r-- | tests/auto/compositor/compositor/mockclient.h | 6 | ||||
-rw-r--r-- | tests/auto/compositor/compositor/mockseat.h | 4 |
7 files changed, 17 insertions, 17 deletions
diff --git a/tests/auto/client/client/tst_client.cpp b/tests/auto/client/client/tst_client.cpp index 8ee52d736..4eb85818c 100644 --- a/tests/auto/client/client/tst_client.cpp +++ b/tests/auto/client/client/tst_client.cpp @@ -170,7 +170,7 @@ private slots: void glWindow(); private: - MockCompositor *compositor; + MockCompositor *compositor = nullptr; }; void tst_WaylandClient::primaryScreen() diff --git a/tests/auto/client/shared/mockcompositor.h b/tests/auto/client/shared/mockcompositor.h index c6de12376..c0c3c884f 100644 --- a/tests/auto/client/shared/mockcompositor.h +++ b/tests/auto/client/shared/mockcompositor.h @@ -141,7 +141,7 @@ private: friend class Impl::Compositor; friend class Impl::Surface; - Impl::Surface *m_surface; + Impl::Surface *m_surface = nullptr; }; Q_DECLARE_METATYPE(QSharedPointer<MockSurface>) @@ -151,7 +151,7 @@ public: Impl::Output *handle() const { return m_output; } MockOutput(Impl::Output *output); private: - Impl::Output *m_output; + Impl::Output *m_output = nullptr; }; Q_DECLARE_METATYPE(QSharedPointer<MockOutput>) @@ -201,7 +201,7 @@ private: typedef void (*Callback)(void *target, const QList<QVariant> ¶meters); Callback callback; - void *target; + void *target = nullptr; QList<QVariant> parameters; }; diff --git a/tests/auto/client/shared/mockinput.h b/tests/auto/client/shared/mockinput.h index 5760ab40c..d9adb3621 100644 --- a/tests/auto/client/shared/mockinput.h +++ b/tests/auto/client/shared/mockinput.h @@ -60,7 +60,7 @@ protected: void seat_get_touch(Resource *resource, uint32_t id) override; private: - Compositor *m_compositor; + Compositor *m_compositor = nullptr; QScopedPointer<Keyboard> m_keyboard; QScopedPointer<Pointer> m_pointer; @@ -83,7 +83,7 @@ protected: void keyboard_destroy_resource(wl_keyboard::Resource *resource) override; private: - Compositor *m_compositor; + Compositor *m_compositor = nullptr; Resource *m_focusResource = nullptr; Surface *m_focus = nullptr; @@ -106,7 +106,7 @@ protected: void pointer_destroy_resource(wl_pointer::Resource *resource) override; private: - Compositor *m_compositor; + Compositor *m_compositor = nullptr; Resource *m_focusResource = nullptr; Surface *m_focus = nullptr; @@ -121,7 +121,7 @@ public: void sendMotion(Surface *surface, const QPoint &position, int id); void sendFrame(Surface *surface); private: - Compositor *m_compositor; + Compositor *m_compositor = nullptr; }; class DataOffer : public QtWaylandServer::wl_data_offer @@ -145,7 +145,7 @@ protected: void data_device_start_drag(Resource *resource, struct ::wl_resource *source, struct ::wl_resource *origin, struct ::wl_resource *icon, uint32_t serial) override; private: - Compositor *m_compositor; + Compositor *m_compositor = nullptr; QtWaylandServer::wl_data_offer *m_dataOffer = nullptr; Surface* m_focus = nullptr; }; @@ -162,7 +162,7 @@ protected: void data_device_manager_create_data_source(Resource *resource, uint32_t id) override; private: - Compositor *m_compositor; + Compositor *m_compositor = nullptr; QScopedPointer<DataDevice> m_data_device; }; diff --git a/tests/auto/client/shared/mocksurface.h b/tests/auto/client/shared/mocksurface.h index 8bf6eb755..68fe9b94c 100644 --- a/tests/auto/client/shared/mocksurface.h +++ b/tests/auto/client/shared/mocksurface.h @@ -65,7 +65,7 @@ protected: private: wl_resource *m_buffer = nullptr; - Compositor *m_compositor; + Compositor *m_compositor = nullptr; QSharedPointer<MockSurface> m_mockSurface; QList<wl_resource *> m_frameCallbackList; bool m_mapped = false; diff --git a/tests/auto/client/xdgshellv6/tst_xdgshellv6.cpp b/tests/auto/client/xdgshellv6/tst_xdgshellv6.cpp index 5aac336f2..9e4aa8c07 100644 --- a/tests/auto/client/xdgshellv6/tst_xdgshellv6.cpp +++ b/tests/auto/client/xdgshellv6/tst_xdgshellv6.cpp @@ -82,7 +82,7 @@ private slots: void createDestroyWindow(); private: - MockCompositor *m_compositor; + MockCompositor *m_compositor = nullptr; }; void tst_WaylandClientXdgShellV6::createDestroyWindow() diff --git a/tests/auto/compositor/compositor/mockclient.h b/tests/auto/compositor/compositor/mockclient.h index 8933f8327..820f2df39 100644 --- a/tests/auto/compositor/compositor/mockclient.h +++ b/tests/auto/compositor/compositor/mockclient.h @@ -45,7 +45,7 @@ public: ~ShmBuffer(); struct wl_buffer *handle = nullptr; - struct wl_shm_pool *shm_pool; + struct wl_shm_pool *shm_pool = nullptr; QImage image; }; @@ -62,10 +62,10 @@ public: xdg_surface *createXdgSurface(wl_surface *surface); ivi_surface *createIviSurface(wl_surface *surface, uint iviId); - wl_display *display; + wl_display *display = nullptr; wl_compositor *compositor = nullptr; QMap<uint, wl_output *> m_outputs; - wl_shm *shm; + wl_shm *shm = nullptr; wl_registry *registry = nullptr; wl_shell *wlshell = nullptr; xdg_shell *xdgShell = nullptr; diff --git a/tests/auto/compositor/compositor/mockseat.h b/tests/auto/compositor/compositor/mockseat.h index e6d5e0b1c..2cdd1df55 100644 --- a/tests/auto/compositor/compositor/mockseat.h +++ b/tests/auto/compositor/compositor/mockseat.h @@ -42,8 +42,8 @@ public: ~MockSeat(); MockPointer *pointer() const { return m_pointer.data(); } - wl_seat *m_seat; - wl_keyboard *m_keyboard; + wl_seat *m_seat = nullptr; + wl_keyboard *m_keyboard = nullptr; private: QScopedPointer<MockPointer> m_pointer; |