Removed a redundant call to SigSession::set_device
[pulseview.git] / pv / mainwindow.cpp
index f72d1b7056041bd5cb34c563f68c7aed3523917e..829c95e994e2691db500fdbdfa5706be3352921e 100644 (file)
@@ -25,6 +25,9 @@
 #include <boost/bind.hpp>
 #include <boost/foreach.hpp>
 
+#include <algorithm>
+#include <iterator>
+
 #include <QAction>
 #include <QApplication>
 #include <QButtonGroup>
@@ -39,7 +42,7 @@
 #include "mainwindow.h"
 
 #include "devicemanager.h"
-#include "device/devinst.h"
+#include "device/device.h"
 #include "dialogs/about.h"
 #include "dialogs/connect.h"
 #include "dialogs/storeprogress.h"
@@ -289,8 +292,10 @@ void MainWindow::update_device_list(
 {
        assert(_sampling_bar);
 
-       const list< shared_ptr<device::DevInst> > &devices =
-               _device_manager.devices();
+       list< shared_ptr<device::DevInst> > devices;
+       std::copy(_device_manager.devices().begin(),
+               _device_manager.devices().end(), std::back_inserter(devices));
+
        _sampling_bar->set_device_list(devices);
 
        if (!selected_device && !devices.empty()) {
@@ -306,8 +311,9 @@ void MainWindow::update_device_list(
        }
 
        if (selected_device) {
+               // Setting the selected device in the sampling bar, generates
+               // an event which updates the selected device in the SigSession.
                _sampling_bar->set_selected_device(selected_device);
-               _session.set_device(selected_device);
        }
 }