[Commits] [wesnoth/wesnoth] cf6cb0: Make AI manager a singleton

GitHub noreply at github.com
Tue Jan 23 21:32:31 UTC 2018


  Branch: refs/heads/singleton-ai
  Home:   https://github.com/wesnoth/wesnoth
  Commit: cf6cb0780cd36cfb0cd9f1c26d6d88d02cdff1b4
      https://github.com/wesnoth/wesnoth/commit/cf6cb0780cd36cfb0cd9f1c26d6d88d02cdff1b4
  Author: Jyrki Vesterinen <sandgtx at gmail.com>
  Date:   2018-01-23 (Tue, 23 Jan 2018)

  Changed paths:
    M src/ai/actions.cpp
    M src/ai/composite/aspect.cpp
    M src/ai/contexts.cpp
    M src/ai/default/aspect_attacks.cpp
    M src/ai/default/attack.cpp
    M src/ai/default/ca.cpp
    M src/ai/default/recruitment.cpp
    M src/ai/default/stage_rca.cpp
    M src/ai/formula/ai.cpp
    M src/ai/gamestate_observer.cpp
    M src/ai/manager.cpp
    M src/ai/manager.hpp
    M src/ai/testing.cpp
    M src/game_events/action_wml.cpp
    M src/game_state.cpp
    M src/game_state.hpp
    M src/gui/dialogs/gamestate_inspector.cpp
    M src/menu_events.cpp
    M src/play_controller.cpp
    M src/playsingle_controller.cpp
    M src/scripting/game_lua_kernel.cpp
    M src/team.cpp
    M src/units/unit.cpp

  Log Message:
  -----------
  Make AI manager a singleton

Fixes #2372.

It turned out that the AI kept dangling references to the old Lua state,
and crashed while destroying AI contexts for destroyed sides.

The best way to avoid it is to ensure that game_state, which already owns
the Lua state, also owns the AI. That way, the AI will be destroyed before
the Lua state and a dangling reference can't stay.





More information about the Commits mailing list