diff options
author | Ivan Solovev <ivan.solovev@qt.io> | 2022-01-20 11:03:15 +0100 |
---|---|---|
committer | Ivan Solovev <ivan.solovev@qt.io> | 2022-01-21 15:50:36 +0100 |
commit | 4d2df2461f304eb7e1db5030e1c63d17bc2bac85 (patch) | |
tree | 7f4251ff5dbda12312b755ab43c6af9f23e87287 /examples | |
parent | 4bd126afaef1cafd42f8806651226e2b37325537 (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.
Pick-to: 6.3 6.2 5.15
Change-Id: If91f01e1ab6dc8e839a06773464eeb9858d2fd36
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'examples')
-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 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; } |