mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
QtBT: avoid crash at exit if no BT device found
If localDevice isn't valid we never initialize the discory agent, so let's not dereference it in the destructor unless it is valid. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
837daa08ea
commit
035e08e633
1 changed files with 10 additions and 7 deletions
|
@ -8,7 +8,8 @@
|
|||
|
||||
BtDeviceSelectionDialog::BtDeviceSelectionDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::BtDeviceSelectionDialog)
|
||||
ui(new Ui::BtDeviceSelectionDialog),
|
||||
remoteDeviceDiscoveryAgent(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -92,15 +93,17 @@ BtDeviceSelectionDialog::~BtDeviceSelectionDialog()
|
|||
// Clean the local device
|
||||
delete localDevice;
|
||||
#endif
|
||||
// Clean the device discovery agent
|
||||
if (remoteDeviceDiscoveryAgent->isActive()) {
|
||||
remoteDeviceDiscoveryAgent->stop();
|
||||
if (remoteDeviceDiscoveryAgent) {
|
||||
// Clean the device discovery agent
|
||||
if (remoteDeviceDiscoveryAgent->isActive()) {
|
||||
remoteDeviceDiscoveryAgent->stop();
|
||||
#if defined(Q_OS_WIN)
|
||||
remoteDeviceDiscoveryAgent->wait();
|
||||
remoteDeviceDiscoveryAgent->wait();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
delete remoteDeviceDiscoveryAgent;
|
||||
delete remoteDeviceDiscoveryAgent;
|
||||
}
|
||||
}
|
||||
|
||||
void BtDeviceSelectionDialog::on_changeDeviceState_clicked()
|
||||
|
|
Loading…
Reference in a new issue