[wesnoth-commits] [wesnoth/wesnoth] a9e534: Fix iterator-use-after-invalidation in tooltips

Steve Cotton noreply at github.com
Sat Nov 6 06:21:27 UTC 2021


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: a9e534812d44f3c5c3a83803434649d65cfb496c
      https://github.com/wesnoth/wesnoth/commit/a9e534812d44f3c5c3a83803434649d65cfb496c
  Author: Steve Cotton <steve at octalot.co.uk>
  Date:   2021-11-06 (Sat, 06 Nov 2021)

  Changed paths:
    M src/tooltips.cpp

  Log Message:
  -----------
  Fix iterator-use-after-invalidation in tooltips

It's undefined behavior to access an iterator after calling std::map::erase(),
the correct method is to use the new iterator that erase() returns instead.

(cherry picked from commit b0c59a558af7197d80f3170fb5d26f9e75f11d82)


  Commit: 7c1a059c5905c0706cb052f02fd9bcaf0e9b940f
      https://github.com/wesnoth/wesnoth/commit/7c1a059c5905c0706cb052f02fd9bcaf0e9b940f
  Author: Steve Cotton <steve at octalot.co.uk>
  Date:   2021-11-06 (Sat, 06 Nov 2021)

  Changed paths:
    M src/font/text.cpp

  Log Message:
  -----------
  Fix pango_text::set_maximum_height

Change back to handling the height in our code instead of expecting Pango to
handle it. Pango is still expected to handle the maximum width, as Pango needs
to handle the word-wrapping.

While writing f282eb7, I had noticed that set_maximum_height called
PangoLayout's pango_layout_set_height, and removed the apparently unnecessary
enforcement of the maximum height from our wrapper code. The documentation
added in this commit explains why that was incorrect.

This fixes the bug that some tooltips on the sidebar stopped working. The text
on that sidebar is densely packed, and while this commit makes no visual
change, it removes a few blank pixels of padding below the text. That extra
padding was sufficient for the next line's area to overlap, making
tooltips::add_tooltip remove the previously-added tooltip.

There's still a known issue with 800x600 resolution. At that resolution, the
side-flag is ellipsed (even if the unit has a short name), and the tooltips for
both the name and the flag are missing. The movement and defense tooltips (both
are on the line above the name and flag) are sometimes also missing in 800x600.

(cherry picked from commit 8304ada17cd6db77202b1cd0ffe55a8963980d16)


Compare: https://github.com/wesnoth/wesnoth/compare/e4497ba160b3...7c1a059c5905



More information about the Commits mailing list