summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-12-16 14:35:25 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-12-16 14:35:25 -0600
commitf2a0a2c30b257aa0fca5039f87aeadf247b8381d (patch)
tree35111a02fe8b2291db8e7fe7ea05c4f1e31374fa /ui
parent79a263772b9f489c471ca189e8467a50657c5180 (diff)
downloadhorizon-f2a0a2c30b257aa0fca5039f87aeadf247b8381d.tar.gz
horizon-f2a0a2c30b257aa0fca5039f87aeadf247b8381d.tar.bz2
horizon-f2a0a2c30b257aa0fca5039f87aeadf247b8381d.tar.xz
horizon-f2a0a2c30b257aa0fca5039f87aeadf247b8381d.zip
Qt UI: Handle failures better
If we pop a modal box before disabling the notifier, we'll get multiple messages. When a user clicks OK on the second message, it will attempt to double-free, causing a segfault. Whoops.
Diffstat (limited to 'ui')
-rw-r--r--ui/qt5/netsimplewifipage.cc25
1 files changed, 15 insertions, 10 deletions
diff --git a/ui/qt5/netsimplewifipage.cc b/ui/qt5/netsimplewifipage.cc
index 9df3d76..9b77295 100644
--- a/ui/qt5/netsimplewifipage.cc
+++ b/ui/qt5/netsimplewifipage.cc
@@ -281,6 +281,8 @@ void NetworkSimpleWirelessPage::associate() {
}
void NetworkSimpleWirelessPage::processAssociateMessage(int) {
+ QString error;
+
if(wpactrl_update(&control) < 0) {
dialog->setLabelText(tr("Issue communicating with wireless subsystem."));
} else {
@@ -301,25 +303,28 @@ void NetworkSimpleWirelessPage::processAssociateMessage(int) {
associated = true;
horizonWizard()->next();
} else if(msg.startsWith("CTRL-EVENT-ASSOC-REJECT")) {
- dialog->hide();
- QMessageBox::critical(this, tr("Could Not Connect"),
- tr("An issue occurred connecting to the specified wireless network. "
- "You may need to move closer to your wireless gateway, or reset your hardware and try again.\n\n"
- "Technical details: %1").arg(msg));
+ error = tr("There was an issue connecting to your wireless network. "
+ "You may need to move closer to your wireless gateway, or reset your hardware and try again.\n\n"
+ "Technical details: %1").arg(msg);
} else if(msg.startsWith("CTRL-EVENT-AUTH-REJECT")) {
- dialog->hide();
- QMessageBox::critical(this, tr("Could Not Connect"),
- tr("An issue occurred connecting to the specified wireless network. "
- "Ensure your passphrase is correct and try again.\n\n"
- "Technical details: %1").arg(msg));
+ error = tr("There was an issue connecting to your wireless network. "
+ "Ensure your passphrase is correct and try again.\n\n"
+ "Technical details: %1").arg(msg);
} else {
/* unknown message. */
return;
}
}
+
connNotify->setEnabled(false);
connNotify->deleteLater();
connNotify = nullptr;
+
+ if(!associated) {
+ dialog->hide();
+ QMessageBox::critical(this, tr("Could Not Connect"), error);
+ }
+
return;
}