Merge lp:~widelands-dev/widelands/bug-1818494-workaround-math-clamp-zoom-everywhere into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 9035
Proposed branch: lp:~widelands-dev/widelands/bug-1818494-workaround-math-clamp-zoom-everywhere
Merge into: lp:widelands
Diff against target: 22 lines (+4/-1)
1 file modified
src/wui/mapview.cc (+4/-1)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1818494-workaround-math-clamp-zoom-everywhere
Reviewer Review Type Date Requested Status
hessenfarmer test Approve
Review via email: mp+365321@code.launchpad.net

Commit message

Use math::clamp to ensure that zoom will stay within range.

Description of the change

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.

To post a comment you must log in.
Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 4661. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/513789175.
Appveyor build 4448. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1818494_workaround_math_clamp_zoom_everywhere-4448.

Revision history for this message
GunChleoc (gunchleoc) wrote :

We now have a protocol in the bug and it looks like this fix is OK, so let's have it in trunk ASAP.

Revision history for this message
hessenfarmer (stephan-lutz) wrote :

I just tested the branch and did some Zooming moving around using the minimap to change view.

No anomalies. But I wasn't able to reproduce the original bug in older branches so no idea if this is fixed. At least it should be safe to go.

review: Approve (test)
Revision history for this message
GunChleoc (gunchleoc) wrote :

Let's have it then and hope that it will fix it.

@bunnybot merge

Revision history for this message
hessenfarmer (stephan-lutz) wrote :

As I interpret the latest log from HHKing unfortunately it is not fixed yet

Revision history for this message
GunChleoc (gunchleoc) wrote :

No, it's not :'(

I have pushed another attempt for him to fix to the logging branch and have created a new one, but I will hold off with further merge requests until we hear back from him.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/wui/mapview.cc'
2--- src/wui/mapview.cc 2019-03-25 10:46:23 +0000
3+++ src/wui/mapview.cc 2019-03-31 15:40:28 +0000
4@@ -123,7 +123,8 @@
5 std::deque<MapView::TimestampedView>* plan) {
6 for (int i = 1; i < kNumKeyFrames - 2; i++) {
7 float dt = (duration_ms / kNumKeyFrames) * i;
8- const float zoom = zoom_t.value(dt);
9+ // Using math::clamp as a workaround for https://bugs.launchpad.net/widelands/+bug/1818494
10+ const float zoom = math::clamp(zoom_t.value(dt), 1.f / kMaxZoom, kMaxZoom);
11 const Vector2f center_point = center_point_t.value(dt);
12 const Vector2f viewpoint = center_point - Vector2f(width * zoom / 2.f, height * zoom / 2.f);
13 plan->push_back(MapView::TimestampedView{
14@@ -392,6 +393,8 @@
15 return;
16 }
17 view_ = target_view;
18+ // Using math::clamp as a workaround for https://bugs.launchpad.net/widelands/+bug/1818494
19+ view_.zoom = math::clamp(view_.zoom, 1.f / kMaxZoom, kMaxZoom);
20 MapviewPixelFunctions::normalize_pix(map_, &view_.viewpoint);
21 changeview();
22 return;

Subscribers

People subscribed via source and target branches

to status/vote changes: