From 7922e6addb06de89cc73c64d30321aa6710e30ce Mon Sep 17 00:00:00 2001 From: Lukas Pioch Date: Mon, 29 May 2017 21:33:30 +0200 Subject: Fixes problems with windows: - Changed cPlayer:OpenWindow to accept a ref, tolua adds a nil check - Close open lua window in destructor, to avoid dangling pointers --- src/Entities/Player.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/Entities/Player.cpp') diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index c0a078bcb..b11c07a0b 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -1310,15 +1310,15 @@ cTeam * cPlayer::UpdateTeam(void) -void cPlayer::OpenWindow(cWindow * a_Window) +void cPlayer::OpenWindow(cWindow & a_Window) { - if (a_Window != m_CurrentWindow) + if (&a_Window != m_CurrentWindow) { CloseWindow(false); } - a_Window->OpenedByPlayer(*this); - m_CurrentWindow = a_Window; - a_Window->SendWholeWindow(*GetClientHandle()); + a_Window.OpenedByPlayer(*this); + m_CurrentWindow = &a_Window; + a_Window.SendWholeWindow(*GetClientHandle()); } -- cgit v1.2.3