Skip to content
Snippets Groups Projects

Actor.canSee fix

Merged Samuel Wegner requested to merge Effigy/t-engine4:cansee_fix into master
  1. Oct 10, 2015
    • Samuel Wegner's avatar
      Set can_see_cache to weak table · d96e30da
      Samuel Wegner authored
      Previously, if the "can_see_cache" property is not initialized when
      Actor.canSee() is called, it will be set to a strong table. This seems
      bad because this table can hold references to other actors and possibly
      prevent garbage collection. Actor.resetCanSeeCache() sets
      "can_see_cache" to a weak table, so I think the same should be done for
      initializing the property in Actor.canSee().
      
      Now, Actor.canSee() will initialize "can_see_cache" with a weak table
      if it doesn't already exist.
      
      I stumbled across this while investigating the Warden's Call memory
      leak and found references to the clones in game.player.can_see_cache.
      Unfortunately, this change doesn't seem to fix that problem.
      d96e30da
Loading