From e199f72686224011fe8da23b8db8befb5a0bd2b4 Mon Sep 17 00:00:00 2001 From: Hyunjin Song Date: Tue, 28 Apr 2020 14:39:39 +0900 Subject: [PATCH] Fix crash on drawing line on the end of a graph (#5471) This bug was introduced in dff76b2e83d4cfe140a8554f590cfd3780b61204. The function changes [sample_end, sample_begin), but emits the signal as if [sample_end, sample_begin] has been changed. That bug made Multitap Echo crash when tweaking the cutoff of the 32nd stage. This commit fixes the issue by emitting sampleChanged with sample_end - 1. --- src/gui/widgets/Graph.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/Graph.cpp b/src/gui/widgets/Graph.cpp index 4710089dd..773a6f51b 100644 --- a/src/gui/widgets/Graph.cpp +++ b/src/gui/widgets/Graph.cpp @@ -235,8 +235,9 @@ void Graph::drawLineAt( int _x, int _y, int _lastx ) model()->drawSampleAt( sample_begin + i , val_begin + ((i ) * ystep)); } - - model()->samplesChanged( sample_begin, sample_end ); + // We've changed [sample_end, sample_begin) + // However, samplesChanged expects two end points + model()->samplesChanged(sample_begin, sample_end - 1); } void Graph::changeSampleAt( int _x, int _y )