diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2014-01-27 17:36:14 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-29 08:55:23 +0100 |
commit | 7f6c59623c535fcd2075464e3870e9897c3f5f2b (patch) | |
tree | 66ad2be5690e2e3366592e586566626616654b7e | |
parent | d85171d34a28e53d416609fb0e60129f570463cf (diff) |
Don't cache the QBluetoothSocket::localName() & peerName()
This affects Bluez only. The other platforms don't use this feature.
The problem was triggered when connecting, disconnecting and connecting
again to another device. localName() might change due to a different
local Bluetooth adapter being used and peerName() is different anyway
in such cases.
Change-Id: I8983a355832cf4f4d9a654971c54f5624be288e6
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
-rw-r--r-- | src/bluetooth/qbluetoothsocket_bluez.cpp | 14 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothsocket_p.h | 2 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothsocket_qnx.cpp | 2 |
3 files changed, 3 insertions, 15 deletions
diff --git a/src/bluetooth/qbluetoothsocket_bluez.cpp b/src/bluetooth/qbluetoothsocket_bluez.cpp index d12acf7c..bb8e9685 100644 --- a/src/bluetooth/qbluetoothsocket_bluez.cpp +++ b/src/bluetooth/qbluetoothsocket_bluez.cpp @@ -266,9 +266,6 @@ void QBluetoothSocketPrivate::abort() QString QBluetoothSocketPrivate::localName() const { - if (!m_localName.isEmpty()) - return m_localName; - const QBluetoothAddress address = localAddress(); if (address.isNull()) return QString(); @@ -289,9 +286,7 @@ QString QBluetoothSocketPrivate::localName() const if (properties.isError()) return QString(); - m_localName = properties.value().value(QLatin1String("Name")).toString(); - - return m_localName; + return properties.value().value(QLatin1String("Name")).toString(); } QBluetoothAddress QBluetoothSocketPrivate::localAddress() const @@ -340,9 +335,6 @@ quint16 QBluetoothSocketPrivate::localPort() const QString QBluetoothSocketPrivate::peerName() const { - if (!m_peerName.isEmpty()) - return m_peerName; - quint64 bdaddr; if (socketType == QBluetoothServiceInfo::RfcommProtocol) { @@ -400,9 +392,7 @@ QString QBluetoothSocketPrivate::peerName() const if (properties.isError()) return QString(); - m_peerName = properties.value().value(QLatin1String("Alias")).toString(); - - return m_peerName; + return properties.value().value(QLatin1String("Alias")).toString(); } QBluetoothAddress QBluetoothSocketPrivate::peerAddress() const diff --git a/src/bluetooth/qbluetoothsocket_p.h b/src/bluetooth/qbluetoothsocket_p.h index 92712911..08a6ec86 100644 --- a/src/bluetooth/qbluetoothsocket_p.h +++ b/src/bluetooth/qbluetoothsocket_p.h @@ -150,8 +150,6 @@ protected: QBluetoothSocket *q_ptr; private: - mutable QString m_localName; - mutable QString m_peerName; #ifdef QT_QNX_BLUETOOTH QBluetoothAddress m_peerAddress; QBluetoothUuid m_uuid; diff --git a/src/bluetooth/qbluetoothsocket_qnx.cpp b/src/bluetooth/qbluetoothsocket_qnx.cpp index 6c87011b..0be90ec9 100644 --- a/src/bluetooth/qbluetoothsocket_qnx.cpp +++ b/src/bluetooth/qbluetoothsocket_qnx.cpp @@ -195,7 +195,7 @@ quint16 QBluetoothSocketPrivate::localPort() const QString QBluetoothSocketPrivate::peerName() const { - return m_peerName; + return QString(); } QBluetoothAddress QBluetoothSocketPrivate::peerAddress() const |