TrinityCore/TrinityCore — Issue #4566: Crash at Aura Deletion
Author: luciolis
Created: 2011-12-31 22:28:13+00:00
State: open

Hello,

I have often a crash in the destructor of Unit or in Unit update, this is a segfault where parsing the m_removedAuras list to delete each member of the list.

For example :

#0 std::_List_base >::_M_clear (this=0x7fff52e7e000, __in_chrg=) at /usr/include/c++/4.4/bits/list.tcc:72
__cur = 0x7fff00000000
#1 ~_List_base (this=0x7fff52e7e000, __in_chrg=) at /usr/include/c++/4.4/bits/stl_list.h:360
No locals.
#2 ~list (this=0x7fff52e7e000, __in_chrg=) at /usr/include/c++/4.4/bits/stl_list.h:418
No locals.
#3 ~Unit (this=0x7fff52e7e000, __in_chrg=) at /home/game/origins/compil/darluok/src/server/game/Entities/Unit/Unit.cpp:295
No locals.

#0 0x00000000008e4fa9 in Unit::_DeleteRemovedAuras (this=0x7fff11d01000,
time=262)
at /home/game/origins/compil/darluok/src/server/game/Entities/Unit/Unit.cpp:2830
No locals.
#1 Unit::_UpdateSpells (this=0x7fff11d01000, time=262)
at /home/game/origins/compil/darluok/src/server/game/Entities/Unit/Unit.cpp:2871
No locals.
#2 0x00000000008fb55a in Unit::Update (this=0x7fff11d01000, p_time=262)
at /home/game/origins/compil/darluok/src/server/game/Entities/Unit/Unit.cpp:307
__FUNCTION__ = "Update"
#3 0x0000000000997d62 in Creature::Update (this=0x7fff11d01000, diff=262)
at /home/game/origins/compil/darluok/src/server/game/Entities/Creature/Creature.cpp:503
bInCombat =
#4 0x0000000000a61f0d in Trinity::ObjectUpdater::Visit (
this=, obj=,
gridVisitor=, worldVisitor=)
at /home/game/origins/compil/darluok/src/server/game/Grids/Notifiers/GridNotifiersImpl.h:44
No locals.

It crashes at delete m_removedAuras.front();
Do you have an idea where this pointer could be desallocated or something like this. Is this function thread safe (destructor could be called by 2 threads at the same time?).

Thank you and happy new year.