Fixed LuaWindow destructor causing a crash.
It was leaving the m_Contents' relations to listeners and SlotAreas' relations to m_Contents, which were already gone.
This commit is contained in:
parent
5efbb46ff0
commit
8fe6bb55dd
|
@ -48,6 +48,16 @@ cLuaWindow::cLuaWindow(cWindow::WindowType a_WindowType, int a_SlotsX, int a_Slo
|
||||||
|
|
||||||
cLuaWindow::~cLuaWindow()
|
cLuaWindow::~cLuaWindow()
|
||||||
{
|
{
|
||||||
|
m_Contents.RemoveListener(*this);
|
||||||
|
|
||||||
|
// Must delete slot areas now, because they are referencing this->m_Contents and would try to access it in cWindow's
|
||||||
|
// destructor, when the member is already gone.
|
||||||
|
for (cSlotAreas::iterator itr = m_SlotAreas.begin(), end = m_SlotAreas.end(); itr != end; ++itr)
|
||||||
|
{
|
||||||
|
delete *itr;
|
||||||
|
}
|
||||||
|
m_SlotAreas.clear();
|
||||||
|
|
||||||
ASSERT(m_OpenedBy.empty());
|
ASSERT(m_OpenedBy.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user