projects
/
pulseview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
42e634c
)
SamplingBar: Improved event loop protection
author
Joel Holdsworth
<joel@airwebreathe.org.uk>
Tue, 11 Feb 2014 21:33:14 +0000
(21:33 +0000)
committer
Joel Holdsworth
<joel@airwebreathe.org.uk>
Tue, 11 Feb 2014 21:44:46 +0000
(21:44 +0000)
pv/toolbars/samplingbar.cpp
patch
|
blob
|
history
diff --git
a/pv/toolbars/samplingbar.cpp
b/pv/toolbars/samplingbar.cpp
index 35de916b6ef76465535f9852c65a4dc88437960c..e55bbda8316cb4482dd9f9ec2ef4b57a46773d12 100644
(file)
--- a/
pv/toolbars/samplingbar.cpp
+++ b/
pv/toolbars/samplingbar.cpp
@@
-164,10
+164,14
@@
void SamplingBar::update_sample_rate_selector()
const uint64_t *elements = NULL;
gsize num_elements;
const uint64_t *elements = NULL;
gsize num_elements;
+ if (_updating_sample_rate)
+ return;
+
const shared_ptr<DevInst> dev_inst = get_selected_device();
if (!dev_inst)
return;
const shared_ptr<DevInst> dev_inst = get_selected_device();
if (!dev_inst)
return;
+ assert(!_updating_sample_rate);
_updating_sample_rate = true;
if (!(gvar_dict = dev_inst->list_config(NULL, SR_CONF_SAMPLERATE)))
_updating_sample_rate = true;
if (!(gvar_dict = dev_inst->list_config(NULL, SR_CONF_SAMPLERATE)))
@@
-224,6
+228,9
@@
void SamplingBar::update_sample_rate_selector_value()
GVariant *gvar;
uint64_t samplerate;
GVariant *gvar;
uint64_t samplerate;
+ if (_updating_sample_rate)
+ return;
+
const shared_ptr<DevInst> dev_inst = get_selected_device();
if (!dev_inst)
return;
const shared_ptr<DevInst> dev_inst = get_selected_device();
if (!dev_inst)
return;
@@
-235,6
+242,7
@@
void SamplingBar::update_sample_rate_selector_value()
samplerate = g_variant_get_uint64(gvar);
g_variant_unref(gvar);
samplerate = g_variant_get_uint64(gvar);
g_variant_unref(gvar);
+ assert(!_updating_sample_rate);
_updating_sample_rate = true;
_sample_rate.set_value(samplerate);
_updating_sample_rate = false;
_updating_sample_rate = true;
_sample_rate.set_value(samplerate);
_updating_sample_rate = false;
@@
-244,10
+252,14
@@
void SamplingBar::update_sample_count_selector()
{
GVariant *gvar;
{
GVariant *gvar;
+ if (_updating_sample_count)
+ return;
+
const shared_ptr<DevInst> dev_inst = get_selected_device();
if (!dev_inst)
return;
const shared_ptr<DevInst> dev_inst = get_selected_device();
if (!dev_inst)
return;
+ assert(!_updating_sample_count);
_updating_sample_count = true;
if (_sample_count_supported)
_updating_sample_count = true;
if (_sample_count_supported)
@@
-292,6
+304,9
@@
void SamplingBar::commit_sample_count()
{
uint64_t sample_count = 0;
{
uint64_t sample_count = 0;
+ if (_updating_sample_count)
+ return;
+
const shared_ptr<DevInst> dev_inst = get_selected_device();
if (!dev_inst)
return;
const shared_ptr<DevInst> dev_inst = get_selected_device();
if (!dev_inst)
return;
@@
-299,17
+314,23
@@
void SamplingBar::commit_sample_count()
sample_count = _sample_count.value();
// Set the sample count
sample_count = _sample_count.value();
// Set the sample count
+ assert(!_updating_sample_count);
+ _updating_sample_count = true;
if (!dev_inst->set_config(NULL, SR_CONF_LIMIT_SAMPLES,
g_variant_new_uint64(sample_count))) {
qDebug() << "Failed to configure sample count.";
return;
}
if (!dev_inst->set_config(NULL, SR_CONF_LIMIT_SAMPLES,
g_variant_new_uint64(sample_count))) {
qDebug() << "Failed to configure sample count.";
return;
}
+ _updating_sample_count = false;
}
void SamplingBar::commit_sample_rate()
{
uint64_t sample_rate = 0;
}
void SamplingBar::commit_sample_rate()
{
uint64_t sample_rate = 0;
+ if (_updating_sample_rate)
+ return;
+
const shared_ptr<DevInst> dev_inst = get_selected_device();
if (!dev_inst)
return;
const shared_ptr<DevInst> dev_inst = get_selected_device();
if (!dev_inst)
return;
@@
-319,11
+340,14
@@
void SamplingBar::commit_sample_rate()
return;
// Set the samplerate
return;
// Set the samplerate
+ assert(!_updating_sample_rate);
+ _updating_sample_rate = true;
if (!dev_inst->set_config(NULL, SR_CONF_SAMPLERATE,
g_variant_new_uint64(sample_rate))) {
qDebug() << "Failed to configure samplerate.";
return;
}
if (!dev_inst->set_config(NULL, SR_CONF_SAMPLERATE,
g_variant_new_uint64(sample_rate))) {
qDebug() << "Failed to configure samplerate.";
return;
}
+ _updating_sample_rate = false;
}
void SamplingBar::on_device_selected()
}
void SamplingBar::on_device_selected()
@@
-381,14
+405,12
@@
void SamplingBar::on_device_selected()
void SamplingBar::on_sample_count_changed()
{
void SamplingBar::on_sample_count_changed()
{
- if(!_updating_sample_count)
- commit_sample_count();
+ commit_sample_count();
}
void SamplingBar::on_sample_rate_changed()
{
}
void SamplingBar::on_sample_rate_changed()
{
- if (!_updating_sample_rate)
- commit_sample_rate();
+ commit_sample_rate();
}
void SamplingBar::on_run_stop()
}
void SamplingBar::on_run_stop()