diff options
Diffstat (limited to 'src/bluetooth/qbluetoothdevicewatcher_winrt.cpp')
-rw-r--r-- | src/bluetooth/qbluetoothdevicewatcher_winrt.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/bluetooth/qbluetoothdevicewatcher_winrt.cpp b/src/bluetooth/qbluetoothdevicewatcher_winrt.cpp index 336e3cdc..455e6fc4 100644 --- a/src/bluetooth/qbluetoothdevicewatcher_winrt.cpp +++ b/src/bluetooth/qbluetoothdevicewatcher_winrt.cpp @@ -64,11 +64,7 @@ QBluetoothDeviceWatcherWinRT::QBluetoothDeviceWatcherWinRT(int id, winrt::hstrin QBluetoothDeviceWatcherWinRT::~QBluetoothDeviceWatcherWinRT() { - if (m_watcher && m_initialized) { - stop(); - unsubscribeFromEvents(); - m_initialized = false; - } + stop(); } bool QBluetoothDeviceWatcherWinRT::init() @@ -78,23 +74,23 @@ bool QBluetoothDeviceWatcherWinRT::init() "Detection of Bluetooth devices might not work correctly."); return false; } - if (!m_initialized) { - subscribeToEvents(); - m_initialized = true; - } return true; } void QBluetoothDeviceWatcherWinRT::start() { - if (m_watcher) + if (m_watcher) { + subscribeToEvents(); m_watcher.Start(); + } } void QBluetoothDeviceWatcherWinRT::stop() { - if (m_watcher && canStop()) + if (m_watcher && canStop()) { + unsubscribeFromEvents(); m_watcher.Stop(); + } } void QBluetoothDeviceWatcherWinRT::subscribeToEvents() |