This is to resolve an issue reported by valgrind:
==7892==
==7892== Invalid read of size 4
==7892== at 0x4B5C7BA: operator-= (vector2.h:196)
==7892== by 0x4B5C7BA: Dali::Vector2::operator-(Dali::Vector2 const&) const (vector2.h:184)
==7892== by 0x4B912BF: Dali::Internal::SceneGraph::PanGesture::InterpolatePoint(std::vector<Dali::Internal::SceneGraph::PanGesture::PanInfo, std::allocator<Dali::Internal::SceneGraph::PanGesture::PanInfo> >&, unsigned int, unsigned int, unsigned int, Dali::Internal::SceneGraph::PanGesture::PanInfo&, Dali::Internal::SceneGraph::PanGesture::RelativeVectors&, int, bool) (scene-graph-pan-gesture.cpp:947)
Change-Id: I99e494a5859df175109dc9cf74cf2ad1c7aecbd9
Signed-off-by: Tom Robinson <tom.robinson@samsung.com>
PanInfoHistoryIter historyBegin = history.begin();
PanInfoHistoryIter lastIt = history.end();
bool pointGenerated = false;
+ bool havePreviousPoint = false;
RelativeVectors newAcceleration;
// Iterate through point history to perform interpolation.
divisor += 1.0f / timeDelta;
// Acceleration requires a previous point.
- if( lastIt != history.end() )
+ if( havePreviousPoint )
{
// Time delta of input.
float timeDifference( GetDivisibleTimeDifference( it->time, lastIt->time, 1.0f, OUTPUT_TIME_DIFFERENCE ) );
accelerationDivisor += 1.0f / timeDelta;
}
+ else
+ {
+ havePreviousPoint = true;
+ }
tapsUsed++;
lastIt = it;