diff options
author | Ivan Solovev <ivan.solovev@qt.io> | 2022-01-20 11:03:15 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-01-24 11:00:54 +0000 |
commit | e2f13481ee7ea479f0b7c20d61afd833cc6861e1 (patch) | |
tree | 5034f4eba913a1c2da7c33780f17a947348f1225 | |
parent | b7531ea9ffc57d2647c1c35d1cb222b8b2dfb3c6 (diff) |
PingPong example: let the parent QObject do the cleanup
The m_timer and m_serverInfo instances are created using 'this' as a
parent, so we do not need to explicitly delete them in the destructor,
but let the parent object deal with them.
This also prevents a crash at application close.
Change-Id: If91f01e1ab6dc8e839a06773464eeb9858d2fd36
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit 4d2df2461f304eb7e1db5030e1c63d17bc2bac85)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | examples/bluetooth/pingpong/pingpong.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/examples/bluetooth/pingpong/pingpong.cpp b/examples/bluetooth/pingpong/pingpong.cpp index f21a57ac..43575344 100644 --- a/examples/bluetooth/pingpong/pingpong.cpp +++ b/examples/bluetooth/pingpong/pingpong.cpp @@ -64,8 +64,7 @@ PingPong::PingPong(): PingPong::~PingPong() { - delete m_timer; - delete m_serverInfo; + m_timer->stop(); delete socket; delete discoveryAgent; } |