aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-08-27 09:22:17 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-08-27 09:23:38 -0700
commit035e08e633e9eb8fa4bc12dec77dc84218747f95 (patch)
treeddb20de9b8543990c7d4714823bcddbec36620e2
parent837daa08ea85be1658758e57d9f9f212fdc2f004 (diff)
downloadsubsurface-035e08e633e9eb8fa4bc12dec77dc84218747f95.tar.gz
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>
-rw-r--r--qt-ui/btdeviceselectiondialog.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/qt-ui/btdeviceselectiondialog.cpp b/qt-ui/btdeviceselectiondialog.cpp
index bd7ad1e3d..17ef634bb 100644
--- a/qt-ui/btdeviceselectiondialog.cpp
+++ b/qt-ui/btdeviceselectiondialog.cpp
@@ -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()