diff options
author | Alex Blasche <alexander.blasche@qt.io> | 2017-06-29 11:15:15 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@qt.io> | 2017-06-29 09:57:39 +0000 |
commit | b827a21be00f5161b4b42ddaf3f8a46477d39054 (patch) | |
tree | ccd415442d205262a96b986bae13b54e3b09f335 /src/bluetooth/qbluetoothsocket_android.cpp | |
parent | 31990acd549f3f811b60caefa6371ec8fc09bb4b (diff) |
Android: Do not emit QBluetoothSocket::bytesWritten() if write() failed
QBluetoothSocket::write() emits the bytesWritten(int) signal when the write
was successful. java.io.OutputStream.write() returns an exception when
it fails. We should not emit bytesWritten() if such an exception occurred.
Change-Id: I76e7a85188102e8227d586450c3e733c046e9957
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/bluetooth/qbluetoothsocket_android.cpp')
-rw-r--r-- | src/bluetooth/qbluetoothsocket_android.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bluetooth/qbluetoothsocket_android.cpp b/src/bluetooth/qbluetoothsocket_android.cpp index 6a92f29a..d0b901ae 100644 --- a/src/bluetooth/qbluetoothsocket_android.cpp +++ b/src/bluetooth/qbluetoothsocket_android.cpp @@ -722,7 +722,6 @@ qint64 QBluetoothSocketPrivate::writeData(const char *data, qint64 maxSize) env->SetByteArrayRegion(nativeData, 0, (qint32)maxSize, reinterpret_cast<const jbyte*>(data)); outputStream.callMethod<void>("write", "([BII)V", nativeData, 0, (qint32)maxSize); env->DeleteLocalRef(nativeData); - emit q->bytesWritten(maxSize); if (env->ExceptionCheck()) { qCWarning(QT_BT_ANDROID) << "Error while writing"; @@ -733,6 +732,7 @@ qint64 QBluetoothSocketPrivate::writeData(const char *data, qint64 maxSize) return -1; } + emit q->bytesWritten(maxSize); return maxSize; } |