diff options
author | Oliver Wolff <oliver.wolff@qt.io> | 2017-08-07 13:25:45 +0200 |
---|---|---|
committer | Oliver Wolff <oliver.wolff@qt.io> | 2017-08-30 13:33:10 +0000 |
commit | 8f1bd6c6c017a0e28160c5325d1c5c86a3e16384 (patch) | |
tree | f0c52eef43831d813ac100f674cb712f598b4297 /src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp | |
parent | dbd70341ea47122239ec90304f1d6c66c34a4acd (diff) |
windows: Make sure everything is properly CoInitialized on desktop use
Task-number: QTBUG-61566
Change-Id: I5f8ff2c3e8a841ab8c5a3fb465d0be4b003d7a2b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp')
-rw-r--r-- | src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp index 363bc438..e9641344 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp @@ -133,6 +133,9 @@ QWinRTBluetoothDeviceDiscoveryWorker::QWinRTBluetoothDeviceDiscoveryWorker(QBlue { qRegisterMetaType<QBluetoothDeviceInfo>(); +#ifdef CLASSIC_APP_BUILD + CoInitialize(NULL); +#endif HRESULT hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Devices_Bluetooth_BluetoothDevice).Get(), &m_deviceStatics); Q_ASSERT_SUCCEEDED(hr); hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Devices_Bluetooth_BluetoothLEDevice).Get(), &m_leDeviceStatics); @@ -142,6 +145,9 @@ QWinRTBluetoothDeviceDiscoveryWorker::QWinRTBluetoothDeviceDiscoveryWorker(QBlue QWinRTBluetoothDeviceDiscoveryWorker::~QWinRTBluetoothDeviceDiscoveryWorker() { stop(); +#ifdef CLASSIC_APP_BUILD + CoUninitialize(); +#endif } void QWinRTBluetoothDeviceDiscoveryWorker::start() |