diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2014-03-04 16:17:09 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-11 10:59:16 +0100 |
commit | 2d2dbd3199a10985c713e97d32688e001e4cb226 (patch) | |
tree | 62e1e34a4507d218ce58f9659c17e73bc9e5ca80 /src/bluetooth/qbluetoothlocaldevice_android.cpp | |
parent | 54ba9be8850dc7fbeb7151ed5579a22965851008 (diff) |
Android: Fix crashes due to concurrency issues
BroadcastReceiver.onReceive() is executed in the main thread whereas
the Qt classes are in a different thread. This created issues whereby
Java's qtObject pointer was reset by the Qt classes/thread but
onReceive still trying to access the same object later on.
In most cases the Qt classes using BroadcastReceiver were half way
through their object tear down. This patch fixes the problem by
guarding qtObject against concurrent thread access and ensures that
the qtObject pointer is reset before the object tear down starts.
Change-Id: Iab97b0af8e10686d97419ac8504f2fe69e9536f3
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'src/bluetooth/qbluetoothlocaldevice_android.cpp')
-rw-r--r-- | src/bluetooth/qbluetoothlocaldevice_android.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/bluetooth/qbluetoothlocaldevice_android.cpp b/src/bluetooth/qbluetoothlocaldevice_android.cpp index 4e441bc2..ff36837b 100644 --- a/src/bluetooth/qbluetoothlocaldevice_android.cpp +++ b/src/bluetooth/qbluetoothlocaldevice_android.cpp @@ -74,6 +74,7 @@ QBluetoothLocalDevicePrivate::QBluetoothLocalDevicePrivate( QBluetoothLocalDevicePrivate::~QBluetoothLocalDevicePrivate() { + receiver->unregisterReceiver(); delete receiver; delete obj; } |