Close WPA listeners when we lose the connection.
[dhcpcd-ui] / src / dhcpcd-qt / dhcpcd-qt.cpp
index e7a3d808f83218be811f8c9600d10d91592655a0..6cb9d9a9acad2a9a1acdd137edddaa34b30ec8f2 100644 (file)
@@ -190,11 +190,21 @@ void DhcpcdQt::statusCallback(const char *status)
                aniCounter = 0;
                onLine = carrier = false;
                setIcon("status", "network-offline");
+               trayIcon->setToolTip(tr("Not connected to dhcpcd"));
+               /* Close down everything */
                if (notifier) {
                        delete notifier;
                        notifier = NULL;
                }
-               trayIcon->setToolTip(tr("Not connected to dhcpcd"));
+               if (ssidMenu) {
+                       delete ssidMenu;
+                       ssidMenu = NULL;
+               }
+               if (preferences) {
+                       delete preferences;
+                       preferences = NULL;
+               }
+               preferencesAction->setEnabled(false);
        } else {
                bool refresh;