From: Soeren Apel Date: Sat, 3 Sep 2016 21:40:20 +0000 (+0200) Subject: MainWindow: Don't save sessions that have no device X-Git-Tag: pulseview-0.4.0~250 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=3503810c0f74998d42e40a5658ce56e0755e0507;p=pulseview.git MainWindow: Don't save sessions that have no device --- diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 8787073d..19c7da4c 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -297,7 +297,7 @@ void MainWindow::save_ui_settings() settings.endGroup(); for (shared_ptr session : sessions_) { - // Ignore sessions using the demo device + // Ignore sessions using the demo device or no device at all if (session->device()) { shared_ptr 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);