GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1818494-workaround-math-clamp-zoom-everywhere into lp:widelands.
Commit message: Use math::clamp to ensure that zoom will stay within range. Requested reviews: Widelands Developers (widelands-dev) Related bugs: Bug #1818494 in widelands: "Crash on "Reset zoom" bzr9005-201903031251 (Release)" https://bugs.launchpad.net/widelands/+bug/1818494 For more details, see: https://code.launchpad.net/~widelands-dev/widelands/bug-1818494-workaround-math-clamp-zoom-everywhere/+merge/365321 I'm no sure whether this actually fixes or only masks the bug. We might only want this in the Build 20 branch, hoping that it will prevent crashes there. -- Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1818494-workaround-math-clamp-zoom-everywhere into lp:widelands.
=== modified file 'src/wui/mapview.cc' --- src/wui/mapview.cc 2019-03-25 10:46:23 +0000 +++ src/wui/mapview.cc 2019-03-31 15:40:28 +0000 @@ -123,7 +123,8 @@ std::deque<MapView::TimestampedView>* plan) { for (int i = 1; i < kNumKeyFrames - 2; i++) { float dt = (duration_ms / kNumKeyFrames) * i; - const float zoom = zoom_t.value(dt); + // Using math::clamp as a workaround for https://bugs.launchpad.net/widelands/+bug/1818494 + const float zoom = math::clamp(zoom_t.value(dt), 1.f / kMaxZoom, kMaxZoom); const Vector2f center_point = center_point_t.value(dt); const Vector2f viewpoint = center_point - Vector2f(width * zoom / 2.f, height * zoom / 2.f); plan->push_back(MapView::TimestampedView{ @@ -392,6 +393,8 @@ return; } view_ = target_view; + // Using math::clamp as a workaround for https://bugs.launchpad.net/widelands/+bug/1818494 + view_.zoom = math::clamp(view_.zoom, 1.f / kMaxZoom, kMaxZoom); MapviewPixelFunctions::normalize_pix(map_, &view_.viewpoint); changeview(); return;
_______________________________________________ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp