From 95237c18d988245fd5f484b70a481891982f5f37 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Sun, 13 Oct 2013 23:00:59 +0100 Subject: [PATCH] Fix segfault in connect device dialog --- pv/prop/binding/deviceoptions.cpp | 2 ++ pv/toolbars/samplingbar.cpp | 8 ++++++++ pv/toolbars/samplingbar.h | 1 + 3 files changed, 11 insertions(+) diff --git a/pv/prop/binding/deviceoptions.cpp b/pv/prop/binding/deviceoptions.cpp index 1b95cfe..513fe85 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 24c5a42..bafb9cd 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 039e4e4..806a79a 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; -- 2.30.2