Browse files

Map::PurgeArea: clear the map reference for all actors

Other code may try to reference it, and we're about to drop the
map from memory.

Fixes a crash in the circus in BG2 after having defeated Kalah.
The cutscene script uses MoveGlobalsTo which tries to access the
map this way.
  • Loading branch information...
1 parent a57efa9 commit 21819f86f77292585a7e6d82d558285334bb6e9c @fizzet fizzet committed Apr 22, 2013
Showing with 2 additions and 0 deletions.
  1. +2 −0 gemrb/core/Map.cpp
@@ -1703,6 +1703,8 @@ void Map::PurgeArea(bool items)
int i=(int) actors.size();
while (i--) {
Actor *ac = actors[i];
+ //we're going to drop the map from memory so clear the reference
+ ac->SetMap(NULL);
if (ac->Modified[IE_STATE_ID]&STATE_NOSAVE) {
if (ac->Modified[IE_MC_FLAGS] & MC_KEEP_CORPSE) {

0 comments on commit 21819f8

Please sign in to comment.