Sometimes the core hangs trying to obtain the lock at Map::UnloadGrid (e.g. when an instance map is reset):
as the getNGrid() method has the line:
Is it really necessary to have the double check? If we have a write lock can we obtain the read lock?
If I replace the first line with
The deadlock never occurs.
- Code:
WriteGuard Guard(GetLock(MAP_LOCK_TYPE_MAPOBJECTS));
delete getNGrid(x, y); // waits here
as the getNGrid() method has the line:
- Code:
ReadGuard Guard(const_cast<Map*>(this)->GetLock(MAP_LOCK_TYPE_MAPOBJECTS));
Is it really necessary to have the double check? If we have a write lock can we obtain the read lock?
If I replace the first line with
- Code:
delete i_grids[x][y];
The deadlock never occurs.