Fix a crash by clearing our reference to the menuwidget when it is deleted
[dhcpcd-ui] / src / dhcpcd-qt / dhcpcd-ssidmenu.cpp
index b1995d90744c56df7dafdb27f8bbcee666cbfb50..459301a8559584cb39f5370d3c637f2290bff64b 100644 (file)
@@ -49,12 +49,22 @@ DhcpcdSsidMenu::DhcpcdSsidMenu(QWidget *parent,
 
 QWidget *DhcpcdSsidMenu::createWidget(QWidget *parent)
 {
+
        ssidWidget = new DhcpcdSsidMenuWidget(parent, wi, scan);
        connect(ssidWidget, SIGNAL(hovered()), this, SLOT(hover()));
        connect(ssidWidget, SIGNAL(triggered()), this, SLOT(trigger()));
        return ssidWidget;
 }
 
+void DhcpcdSsidMenu::deleteWidget(QWidget *widget)
+{
+
+       widget->hide();
+       widget->deleteLater();
+       if (ssidWidget == widget)
+               ssidWidget = NULL;
+}
+
 DHCPCD_WI_SCAN *DhcpcdSsidMenu::getScan()
 {