on xenial help sign in
Make AxisVelocityCalculator::setTimeSource() more robust.
commit9cb758a938890fdbd34fee750c110d4370174644 authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateWed 26 Jun 2013, 13:27 (13 years ago) parentd27a582
1 file changed+7
plugins/Ubuntu/Gestures/AxisVelocityCalculator.cpp+7
plugins/Ubuntu/Gestures/AxisVelocityCalculator.cpp+7
@@ -148,4 +148,11 @@ void AxisVelocityCalculator::setTimeSource(UbuntuGestures::TimeSource *timeSourc
148148 delete m_timeSource;
149149
150150 m_timeSource = timeSource;
151+
152+ if (numSamples() > 0) {
153+ qWarning("AxisVelocityCalculator: changing time source while there are samples present.");
154+ // Any existent samples are based on the old time source and are, therefore, incompatible
155+ // with this new one.
156+ reset();
157+ }
151158}