mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Fix crash on mac os during download from new BLE computer
Ensure that any bluetooth scan started (by changing the device name) in the download-from-dive-computer dialog (desktop version) is stopped before the download process is started up. Because the QT bluetooth discovery agent uses a QTimer internally, it must be stopped from the same thread as it was started from. The download process uses a different thread, so ends up crashing when it tries to dispose of the timer from a different thread. Reported-by: Steve Buie <sbuie321@gmail.com> Signed-off-by: Steve Buie <sbuie321@gmail.com>
This commit is contained in:
parent
1b4111c1f8
commit
8f4f8fe489
1 changed files with 11 additions and 1 deletions
|
@ -365,7 +365,7 @@ void DownloadFromDCWidget::on_product_currentTextChanged(const QString &)
|
||||||
|
|
||||||
void DownloadFromDCWidget::on_device_currentTextChanged(const QString &device)
|
void DownloadFromDCWidget::on_device_currentTextChanged(const QString &device)
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_MACOS)
|
#if defined(BT_SUPPORT) && defined(Q_OS_MACOS)
|
||||||
if (isBluetoothAddress(device)) {
|
if (isBluetoothAddress(device)) {
|
||||||
// ensure we have a discovery running
|
// ensure we have a discovery running
|
||||||
if (btd == nullptr)
|
if (btd == nullptr)
|
||||||
|
@ -430,6 +430,16 @@ void DownloadFromDCWidget::on_downloadCancelRetryButton_clicked()
|
||||||
data->setDevName(address);
|
data->setDevName(address);
|
||||||
data->setDevBluetoothName(name);
|
data->setDevBluetoothName(name);
|
||||||
}
|
}
|
||||||
|
if (btd) {
|
||||||
|
// btd should only be active for mac os.
|
||||||
|
// Need to ensure that any scan is shut down BEFORE starting the download
|
||||||
|
// because internally (as of 5.15.13) the QT discovery agent uses a QTimer
|
||||||
|
// that can only be shut off from the same thread it was started from.
|
||||||
|
QString devAddr = data->devName().startsWith("LE:")
|
||||||
|
? data->devName().right(data->devName().size()-3)
|
||||||
|
: data->devName();
|
||||||
|
getBtDeviceInfo(devAddr);
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
// this breaks an "else if" across lines... not happy...
|
// this breaks an "else if" across lines... not happy...
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue