From: Soeren Apel Date: Fri, 15 Nov 2019 22:34:22 +0000 (+0100) Subject: Fix #1431 by using per-instance member variables X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=0822e33a2eb713815ae2cd5d6fcca0865643bb00;p=pulseview.git Fix #1431 by using per-instance member variables --- diff --git a/pv/views/trace/analogsignal.cpp b/pv/views/trace/analogsignal.cpp index 3430ab3c..6d4b2c67 100644 --- a/pv/views/trace/analogsignal.cpp +++ b/pv/views/trace/analogsignal.cpp @@ -842,7 +842,7 @@ void AnalogSignal::perform_autoranging(bool keep_divs, bool force_update) if (segments.empty()) return; - static double prev_min = 0, prev_max = 0; + double signal_min_ = 0, signal_max_ = 0; double min = 0, max = 0; for (const shared_ptr& segment : segments) { @@ -851,11 +851,11 @@ void AnalogSignal::perform_autoranging(bool keep_divs, bool force_update) max = std::max(max, mm.second); } - if ((min == prev_min) && (max == prev_max) && !force_update) + if ((min == signal_min_) && (max == signal_max_) && !force_update) return; - prev_min = min; - prev_max = max; + signal_min_ = min; + signal_max_ = max; // If we're allowed to alter the div assignment... if (!keep_divs) { diff --git a/pv/views/trace/analogsignal.hpp b/pv/views/trace/analogsignal.hpp index fd724492..0c14b66a 100644 --- a/pv/views/trace/analogsignal.hpp +++ b/pv/views/trace/analogsignal.hpp @@ -183,6 +183,8 @@ private: *display_type_cb_; QSpinBox *pvdiv_sb_, *nvdiv_sb_, *div_height_sb_; + double signal_min_, signal_max_; // Min/max values of this signal's analog data + float scale_; int scale_index_;