Browse Source

Fix possible crash on replaying combat after manual run

Ivan Savenko 1 năm trước cách đây
mục cha
commit
2aec3cde2c

+ 1 - 1
client/CPlayerInterface.cpp

@@ -137,7 +137,7 @@ CPlayerInterface::CPlayerInterface(PlayerColor Player):
 	LOCPLINT = this;
 	playerID=Player;
 	human=true;
-	battleInt = nullptr;
+	battleInt.reset();
 	castleInt = nullptr;
 	makingTurn = false;
 	showingDialog = new ConditionalWait();

+ 1 - 1
client/battle/BattleInterface.cpp

@@ -332,7 +332,7 @@ void BattleInterface::battleFinished(const BattleResult& br, QueryID queryID)
 	GH.windows().pushWindow(wnd);
 
 	curInt->waitWhileDialog(); // Avoid freeze when AI end turn after battle. Check bug #1897
-	CPlayerInterface::battleInt = nullptr;
+	CPlayerInterface::battleInt.reset();
 }
 
 void BattleInterface::spellCast(const BattleSpellCast * sc)

+ 0 - 5
client/battle/BattleWindow.cpp

@@ -192,11 +192,6 @@ void BattleWindow::createTimerInfoWindows()
 	}
 }
 
-BattleWindow::~BattleWindow()
-{
-	CPlayerInterface::battleInt = nullptr;
-}
-
 std::shared_ptr<BattleConsole> BattleWindow::buildBattleConsole(const JsonNode & config) const
 {
 	auto rect = readRect(config["rect"]);

+ 0 - 1
client/battle/BattleWindow.h

@@ -82,7 +82,6 @@ class BattleWindow : public InterfaceObjectConfigurable
 
 public:
 	BattleWindow(BattleInterface & owner );
-	~BattleWindow();
 
 	/// Closes window once battle finished
 	void close();