Bug 1591 - snap to edge not effective
Summary: snap to edge not effective
Status: RESOLVED FIXED
Alias: None
Product: PulseView
Classification: Unclassified
Component: UI (show other bugs)
Version: unreleased development snapshot
Hardware: All All
: Normal normal
Target Milestone: ---
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-22 17:59 CEST by Gerhard Sittig
Modified: 2020-11-13 21:58 CET (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gerhard Sittig 2020-08-22 17:59:10 CEST
Current nightly builds don't "snap to edge" (observed with Linux 64bit builds 
on Ubuntu 18.04). With the mouse above the trace or outside of the traces area, 
in neither case would the cursor snap to an edge in the logic signal. Does this 
reproduce at other sites, or is it something local?
Comment 1 Ralf 2020-11-07 19:37:56 CET
In my development snapshot (d8cdab78d434) it does also not snap to edge.

Bisect shows commit 464f05d59f205225eff1cb435f9ae11716dbe9de (see below)
 
With the patch below (reverting parts of that commit) it snaps again, but I am not familiar with PV, so someone with more insights to PV should judge the effects:

diff --git a/pv/data/analog.cpp b/pv/data/analog.cpp
index 0b5c3772..f99201c5 100644
--- a/pv/data/analog.cpp
+++ b/pv/data/analog.cpp
@@ -73,7 +73,9 @@ void Analog::set_samplerate(double value)
 
 double Analog::get_samplerate() const
 {
-       return samplerate_;
+       if (segments_.empty())
+               return 1.0;
+       return segments_.front()->samplerate();
 }
 
 uint64_t Analog::max_sample_count() const
diff --git a/pv/data/logic.cpp b/pv/data/logic.cpp
index 038da649..e7dc3d0f 100644
--- a/pv/data/logic.cpp
+++ b/pv/data/logic.cpp
@@ -82,7 +82,9 @@ void Logic::set_samplerate(double value)
 
 double Logic::get_samplerate() const
 {
-       return samplerate_;
+       if (segments_.empty())
+               return 1.0;
+       return segments_.front()->samplerate();
 }
 
 uint64_t Logic::max_sample_count() const




git bisect start
# bad: [d8cdab78d434fa575ec3adc61b61cab252a2a8ed] CMakeLists.txt: Only use -Wa,-mbig-obj and -O3 on Windows.
git bisect bad d8cdab78d434fa575ec3adc61b61cab252a2a8ed
# good: [7d5a9c3e79cbfc7640365894c79ef5b6caaa1631] Signal: Reorganize predefined signal names and add more
git bisect good 7d5a9c3e79cbfc7640365894c79ef5b6caaa1631
# bad: [2cc024608cd20a78ad6765adfa0d50792e150c23] DecodeSignal: Ignore decode signals when restoring channel assignment
git bisect bad 2cc024608cd20a78ad6765adfa0d50792e150c23
# good: [9a5ef9a0d7966bf956f0b32bf3a57029a8d7d45a] Fix #1542 by providing std::hash<QString> implementation as needed
git bisect good 9a5ef9a0d7966bf956f0b32bf3a57029a8d7d45a
# bad: [6f43db70c63c683d546566eda0be7f182f614655] TabularDecView: Fix model issues and improve ViewModeVisible
git bisect bad 6f43db70c63c683d546566eda0be7f182f614655
# bad: [999869aa676f7077b7181355eee28e9b025d4cea] Prepare for generated signals
git bisect bad 999869aa676f7077b7181355eee28e9b025d4cea
# bad: [720f47623827824dc77dd9dff643c06e570d9068] Use shared_ptr for async samples_added() notification
git bisect bad 720f47623827824dc77dd9dff643c06e570d9068
# skip: [1f3033cb3e63de7cfe98dab537460443917fece3] Rework signals for modularity
git bisect skip 1f3033cb3e63de7cfe98dab537460443917fece3
# bad: [464f05d59f205225eff1cb435f9ae11716dbe9de] Add SignalBase::clear_sample_data() and local samplerate values
git bisect bad 464f05d59f205225eff1cb435f9ae11716dbe9de
# first bad commit: [464f05d59f205225eff1cb435f9ae11716dbe9de] Add SignalBase::clear_sample_data() and local samplerate values
Comment 2 Soeren Apel 2020-11-13 21:58:28 CET
Fixed in e505bec82f581f838bdcaae3c75bce96676cc9fd, thanks for pointing out the offending commit!