[Commits] [wesnoth/wesnoth] 8a2963: Fix undefined behavior on destroying an event cont...

GitHub noreply at github.com
Fri Jul 22 23:09:36 UTC 2016


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 8a296386e35462e7b2ef064112e0077709c4a400
      https://github.com/wesnoth/wesnoth/commit/8a296386e35462e7b2ef064112e0077709c4a400
  Author: Jyrki Vesterinen <sandgtx at gmail.com>
  Date:   2016-07-22 (Fri, 22 Jul 2016)

  Changed paths:
    M src/events.cpp

  Log Message:
  -----------
  Fix undefined behavior on destroying an event context

The destructor of the context class accidentally incremented the iterator
twice per iteration. If the number of event handlers was odd, the
destructor ended up incrementing the end iterator, which is UB.

I rewrote the whole destructor. It's unnecessary to manually remove event
handlers from the list because the list will do it automatically when it's
destroyed.


  Commit: b9b97bab844600e16780799a33192365a2ce5c36
      https://github.com/wesnoth/wesnoth/commit/b9b97bab844600e16780799a33192365a2ce5c36
  Author: Andreas <andreas at alternating.net>
  Date:   2016-07-23 (Sat, 23 Jul 2016)

  Changed paths:
    M src/events.cpp

  Log Message:
  -----------
  Merge pull request #709 from jyrkive/fix-event-context-crash

Fix undefined behavior on destroying an event context


Compare: https://github.com/wesnoth/wesnoth/compare/681322bf2935...b9b97bab8446


More information about the Commits mailing list