summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2016-07-30 18:50:49 -0400
committerIvo van Dongen <info@ivovandongen.nl>2016-07-30 18:55:51 -0400
commit8f438ecdb74de29028080e6472b8381fa0764837 (patch)
tree7c663866d33902d628b4512ed95a383e12f08aaf
parent5c0fa36314c30ccec74d8cdd96d10dfad6722273 (diff)
downloadqtlocation-mapboxgl-upstream/5836-chained-animations-bug.tar.gz
[core] #5836 - kill transition finish function pointer before calling to avoid loopupstream/5836-chained-animations-bug
-rw-r--r--src/mbgl/map/transform.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mbgl/map/transform.cpp b/src/mbgl/map/transform.cpp
index 41fc36ce27..55fdb37732 100644
--- a/src/mbgl/map/transform.cpp
+++ b/src/mbgl/map/transform.cpp
@@ -559,7 +559,9 @@ void Transform::startTransition(const CameraOptions& camera,
std::function<Update(double)> frame,
const Duration& duration) {
if (transitionFinishFn) {
- transitionFinishFn();
+ std::function<void()> tmpFunction = transitionFinishFn;
+ transitionFinishFn = nullptr;
+ tmpFunction();
}
bool isAnimated = duration != Duration::zero();
@@ -599,8 +601,9 @@ void Transform::startTransition(const CameraOptions& camera,
callback(MapChangeRegionIsChanging);
}
} else {
- transitionFinishFn();
+ std::function<void()> tmpFunction = transitionFinishFn;
transitionFinishFn = nullptr;
+ tmpFunction();
// This callback gets destroyed here,
// we can only return after this point.
@@ -636,11 +639,12 @@ Update Transform::updateTransitions(const TimePoint& now) {
void Transform::cancelTransitions() {
if (transitionFinishFn) {
- transitionFinishFn();
+ std::function<void()> tmpFunction = transitionFinishFn;
+ transitionFinishFn = nullptr;
+ tmpFunction();
}
transitionFrameFn = nullptr;
- transitionFinishFn = nullptr;
}
void Transform::setGestureInProgress(bool inProgress) {