From: Joel Holdsworth Date: Sun, 13 Oct 2013 22:00:59 +0000 (+0100) Subject: Fix segfault in connect device dialog X-Git-Tag: pulseview-0.2.0~250 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=95237c18d988245fd5f484b70a481891982f5f37;p=pulseview.git Fix segfault in connect device dialog --- diff --git a/pv/prop/binding/deviceoptions.cpp b/pv/prop/binding/deviceoptions.cpp index 1b95cfe0..513fe856 100644 --- a/pv/prop/binding/deviceoptions.cpp +++ b/pv/prop/binding/deviceoptions.cpp @@ -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; diff --git a/pv/toolbars/samplingbar.cpp b/pv/toolbars/samplingbar.cpp index 24c5a420..bafb9cd4 100644 --- a/pv/toolbars/samplingbar.cpp +++ b/pv/toolbars/samplingbar.cpp @@ -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 &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(); diff --git a/pv/toolbars/samplingbar.h b/pv/toolbars/samplingbar.h index 039e4e41..806a79a6 100644 --- a/pv/toolbars/samplingbar.h +++ b/pv/toolbars/samplingbar.h @@ -80,6 +80,7 @@ private: SigSession &_session; QComboBox _device_selector; + bool _updating_device_selector; pv::widgets::PopupToolButton _configure_button; pv::widgets::PopupToolButton _probes_button;