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

Steve Cotton noreply at github.com
Fri Nov 5 20:42:42 UTC 2021


  Branch: refs/heads/1.16
  Home:   https://github.com/wesnoth/wesnoth
  Commit: b0c59a558af7197d80f3170fb5d26f9e75f11d82
      https://github.com/wesnoth/wesnoth/commit/b0c59a558af7197d80f3170fb5d26f9e75f11d82
  Author: Steve Cotton <steve at octalot.co.uk>
  Date:   2021-11-05 (Fri, 05 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.


  Commit: 8304ada17cd6db77202b1cd0ffe55a8963980d16
      https://github.com/wesnoth/wesnoth/commit/8304ada17cd6db77202b1cd0ffe55a8963980d16
  Author: Steve Cotton <steve at octalot.co.uk>
  Date:   2021-11-05 (Fri, 05 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.


Compare: https://github.com/wesnoth/wesnoth/compare/c2b4d11ebf31...8304ada17cd6



More information about the Commits mailing list