summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2022-01-20 11:03:15 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-01-21 17:11:21 +0000
commitb013a2d764a4e4814699bfefc6adc94b57ead132 (patch)
tree8b2e9b65c13a0a6a586d0a33b1b06c73c0e1d55a
parent3aa737acc1698c61d8566749c1e7ab6d2bab83b6 (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.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/examples/bluetooth/pingpong/pingpong.cpp b/examples/bluetooth/pingpong/pingpong.cpp
index 9a446542..8a91e397 100644
--- a/examples/bluetooth/pingpong/pingpong.cpp
+++ b/examples/bluetooth/pingpong/pingpong.cpp
@@ -60,8 +60,7 @@ PingPong::PingPong()
PingPong::~PingPong()
{
- delete m_timer;
- delete m_serverInfo;
+ m_timer->stop();
delete socket;
delete discoveryAgent;
}