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
Pick-to: 6.2 6.3 5.15
Change-Id: I79cbd0f574e35bbc1c9c3123ce8382f3aad296d4
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
This commit is contained in:
Juha Vuolle 2022-01-19 15:07:25 +02:00
parent 218dcb1a2e
commit debf0fd212
1 changed files with 1 additions and 1 deletions

View File

@ -270,7 +270,7 @@ void PingPong::startServer()
connect(m_serverInfo, &QBluetoothServer::errorOccurred, 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