diff options
author | Oleg Shparber <trollixx@gmail.com> | 2014-04-15 17:25:36 -0700 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-16 10:56:30 +0200 |
commit | 6d9ab3981a1ae9e224b3c6a8cf107049a0ee5095 (patch) | |
tree | f2d3a2eb33bc8c4e4b136902eda6728cb5ef5433 | |
parent | 7d04c97a566c3ec6b17101d7a511767ba09da9a6 (diff) |
Fix a crash in QBluetoothSocket on reconnection attempt (BlueZ)
Ensure a native socket is obtained after QBluetoothSocket has been closed.
[ChangeLog][QtBluetooth][QBluetoothSocket] Fixed a crash on reconnect.
Change-Id: I9f470d23366250dc20ad3305ddec16300c1ad8ec
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
-rw-r--r-- | src/bluetooth/qbluetoothsocket_bluez.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bluetooth/qbluetoothsocket_bluez.cpp b/src/bluetooth/qbluetoothsocket_bluez.cpp index 7ff96dd9..b9ed73a6 100644 --- a/src/bluetooth/qbluetoothsocket_bluez.cpp +++ b/src/bluetooth/qbluetoothsocket_bluez.cpp @@ -134,6 +134,12 @@ void QBluetoothSocketPrivate::connectToService(const QBluetoothAddress &address, Q_UNUSED(openMode); int result = -1; + if (socket == -1 && !ensureNativeSocket(socketType)) { + errorString = QObject::tr("Unknown socket error"); + q->setSocketError(QBluetoothSocket::UnknownSocketError); + return; + } + if (socketType == QBluetoothServiceInfo::RfcommProtocol) { sockaddr_rc addr; |