From d0f259bbf742047dc4399d2de0c67733a0a2166b Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Wed, 21 Dec 2022 18:04:19 +0200 Subject: [PATCH] Fix battle shutdown --- client/battle/BattleInterfaceClasses.cpp | 2 +- client/battle/BattleWindow.cpp | 5 +++++ client/battle/BattleWindow.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/client/battle/BattleInterfaceClasses.cpp b/client/battle/BattleInterfaceClasses.cpp index 99915a070..c3b424ef0 100644 --- a/client/battle/BattleInterfaceClasses.cpp +++ b/client/battle/BattleInterfaceClasses.cpp @@ -638,7 +638,7 @@ void BattleResultWindow::bExitf() close(); - if(dynamic_cast(GH.topInt().get())) + if(dynamic_cast(GH.topInt().get())) GH.popInts(1); //pop battle interface if present //Result window and battle interface are gone. We requested all dialogs to be closed before opening the battle, diff --git a/client/battle/BattleWindow.cpp b/client/battle/BattleWindow.cpp index 48705d660..f601abcde 100644 --- a/client/battle/BattleWindow.cpp +++ b/client/battle/BattleWindow.cpp @@ -99,6 +99,11 @@ BattleWindow::BattleWindow(BattleInterface & owner): addUsedEvents(RCLICK | KEYBOARD); } +BattleWindow::~BattleWindow() +{ + CPlayerInterface::battleInt = nullptr; +} + void BattleWindow::hideQueue() { Settings showQueue = settings.write["battle"]["showQueue"]; diff --git a/client/battle/BattleWindow.h b/client/battle/BattleWindow.h index 78ecd09a3..3afbf2b55 100644 --- a/client/battle/BattleWindow.h +++ b/client/battle/BattleWindow.h @@ -69,6 +69,7 @@ class BattleWindow : public WindowBase public: BattleWindow(BattleInterface & owner ); + ~BattleWindow(); /// Closes window once battle finished (explicit declaration to move into public visibility) using WindowBase::close;