]> sigrok.org Git - pulseview.git/commitdiff
MainWindow: Don't save sessions that have no device
authorSoeren Apel <redacted>
Sat, 3 Sep 2016 21:40:20 +0000 (23:40 +0200)
committerSoeren Apel <redacted>
Sat, 3 Sep 2016 21:40:20 +0000 (23:40 +0200)
pv/mainwindow.cpp

index 8787073d5875e1d82c64d826eb845b26e09c9b3c..19c7da4c4bb895c8b48e37321793a146af52123c 100644 (file)
@@ -297,7 +297,7 @@ void MainWindow::save_ui_settings()
        settings.endGroup();
 
        for (shared_ptr<Session> session : sessions_) {
-               // Ignore sessions using the demo device
+               // Ignore sessions using the demo device or no device at all
                if (session->device()) {
                        shared_ptr<devices::HardwareDevice> device =
                                dynamic_pointer_cast< devices::HardwareDevice >
@@ -306,12 +306,12 @@ void MainWindow::save_ui_settings()
                        if (device &&
                                device->hardware_device()->driver()->name() == "demo")
                                continue;
-               }
 
-               settings.beginGroup("Session" + QString::number(id++));
-               settings.remove("");  // Remove all keys in this group
-               session->save_settings(settings);
-               settings.endGroup();
+                       settings.beginGroup("Session" + QString::number(id++));
+                       settings.remove("");  // Remove all keys in this group
+                       session->save_settings(settings);
+                       settings.endGroup();
+               }
        }
 
        settings.setValue("sessions", id);