]> sigrok.org Git - pulseview.git/commitdiff
Fix segfault in connect device dialog
authorJoel Holdsworth <redacted>
Sun, 13 Oct 2013 22:00:59 +0000 (23:00 +0100)
committerJoel Holdsworth <redacted>
Mon, 14 Oct 2013 11:28:06 +0000 (12:28 +0100)
pv/prop/binding/deviceoptions.cpp
pv/toolbars/samplingbar.cpp
pv/toolbars/samplingbar.h

index 1b95cfe0b2314b89e4f40fe7d3029d2045f59475..513fe856599682411a552c5345fde38384b1255c 100644 (file)
@@ -42,6 +42,8 @@ namespace binding {
 DeviceOptions::DeviceOptions(struct sr_dev_inst *sdi) :
        _sdi(sdi)
 {
+       assert(sdi);
+
        GVariant *gvar_opts, *gvar_list;
        gsize num_opts;
 
index 24c5a420e1782ce0834b172ecdaa60c0e6782d88..bafb9cd406bf05f9c76b54f2d91156e34d593e93 100644 (file)
@@ -68,6 +68,7 @@ SamplingBar::SamplingBar(SigSession &session, QWidget *parent) :
        QToolBar("Sampling Bar", parent),
        _session(session),
        _device_selector(this),
+       _updating_device_selector(false),
        _configure_button(this),
        _probes_button(this),
        _record_length_selector(this),
@@ -123,6 +124,8 @@ SamplingBar::SamplingBar(SigSession &session, QWidget *parent) :
 void SamplingBar::set_device_list(
        const std::list<struct sr_dev_inst*> &devices)
 {
+       _updating_device_selector = true;
+
        _device_selector.clear();
 
        BOOST_FOREACH (sr_dev_inst *sdi, devices) {
@@ -131,6 +134,8 @@ void SamplingBar::set_device_list(
                        qVariantFromValue((void*)sdi));
        }
 
+       _updating_device_selector = false;
+
        update_sample_rate_selector();
 }
 
@@ -297,6 +302,9 @@ void SamplingBar::on_device_selected()
 {
        using namespace pv::popups;
 
+       if (_updating_device_selector)
+               return;
+
        update_sample_rate_selector();
 
        sr_dev_inst *const sdi = get_selected_device();
index 039e4e41192e781dc4ddeff35503928c84d2b043..806a79a6c57547626d6175a9ec6c8ab0ba5fcecb 100644 (file)
@@ -80,6 +80,7 @@ private:
        SigSession &_session;
 
        QComboBox _device_selector;
+       bool _updating_device_selector;
 
        pv::widgets::PopupToolButton _configure_button;
        pv::widgets::PopupToolButton _probes_button;