diff options
author | Oliver Wolff <oliver.wolff@qt.io> | 2019-04-17 12:17:21 +0200 |
---|---|---|
committer | Oliver Wolff <oliver.wolff@qt.io> | 2019-04-25 10:29:34 +0200 |
commit | 68cb332228df1c8730e721061134c18bda37cf02 (patch) | |
tree | 4afe644bb85c55e92973e45a7811435b086ba32f /src/bluetooth/qlowenergycontroller_winrt_new_p.h | |
parent | 5aa37aab69d89691ab7eded7f708915612f1afa3 (diff) |
qlowenergycontroller_winrt_new: Avoid late callbacks that lead to crashes
Users may run into crashes on device disconnects in case that we run
into a callback while the disconnects happen. Thus we have to avoid
calling functions on deleted objects by avoiding lambdas if possible or
using QPointers in lambda captures.
Change-Id: Idcd3781bd396d4ef785191e4c65bae20e5149c04
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/bluetooth/qlowenergycontroller_winrt_new_p.h')
-rw-r--r-- | src/bluetooth/qlowenergycontroller_winrt_new_p.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/bluetooth/qlowenergycontroller_winrt_new_p.h b/src/bluetooth/qlowenergycontroller_winrt_new_p.h index 69ee3fca..fa8e516f 100644 --- a/src/bluetooth/qlowenergycontroller_winrt_new_p.h +++ b/src/bluetooth/qlowenergycontroller_winrt_new_p.h @@ -62,6 +62,7 @@ #include <wrl.h> #include <windows.devices.bluetooth.h> +#include <windows.foundation.collections.h> #include <functional> @@ -142,6 +143,8 @@ private: void registerForValueChanges(const QBluetoothUuid &serviceUuid, const QBluetoothUuid &charUuid); void unregisterFromValueChanges(); + HRESULT onValueChange(ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::IGattCharacteristic *characteristic, + ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::IGattValueChangedEventArgs *args); bool registerForStatusChanges(); void unregisterFromStatusChanges(); @@ -149,7 +152,8 @@ private: void obtainIncludedServices(QSharedPointer<QLowEnergyServicePrivate> servicePointer, Microsoft::WRL::ComPtr<ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::IGattDeviceService> nativeService); - + HRESULT onServiceDiscoveryFinished(ABI::Windows::Foundation::IAsyncOperation<ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceServicesResult *> *op, + AsyncStatus status); }; QT_END_NAMESPACE |