From f43bb5860f860331e6b732036ef231e600fe81aa Mon Sep 17 00:00:00 2001 From: Juha Vuolle Date: Wed, 19 Jan 2022 15:07:25 +0200 Subject: Store the serviceinfo in pingpong example The service info returned by the QBluetoothServer::listen() overload that returns it needs to be stored or otherwise it will be destroyed. The consequence was that the SDP "advertisement" didn't properly include the added pingpong service record on Windows. Task-number: QTBUG-100042 Change-Id: I79cbd0f574e35bbc1c9c3123ce8382f3aad296d4 Reviewed-by: Ivan Solovev Reviewed-by: Alex Blasche (cherry picked from commit debf0fd212b232bcd83c8bb8f51ba2bad2f57a1c) Reviewed-by: Qt Cherry-pick Bot --- examples/bluetooth/pingpong/pingpong.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/bluetooth/pingpong/pingpong.cpp b/examples/bluetooth/pingpong/pingpong.cpp index d80df3d6..f21a57ac 100644 --- a/examples/bluetooth/pingpong/pingpong.cpp +++ b/examples/bluetooth/pingpong/pingpong.cpp @@ -249,7 +249,7 @@ void PingPong::startServer() this, &PingPong::serverError); const QBluetoothUuid uuid(serviceUuid); - m_serverInfo->listen(uuid, QStringLiteral("PingPong server")); + m_serviceInfo = m_serverInfo->listen(uuid, QStringLiteral("PingPong server")); //! [Starting the server] setMessage(QStringLiteral("Server started, waiting for the client. You are the left player.")); // m_role is set to 1 if it is a server -- cgit v1.2.1