From bcd95847a435bb3aab90bdb3c2fdada6063efc2e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 22 Apr 2014 21:54:59 +0300 Subject: Fix crash if start trade with opened storage. --- src/gui/windows/inventorywindow.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/gui/windows/inventorywindow.cpp') diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index c2a4b4636..01e5e052d 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -271,7 +271,8 @@ void InventoryWindow::postInit() InventoryWindow::~InventoryWindow() { invInstances.remove(this); - mInventory->removeInventoyListener(this); + if (mInventory) + mInventory->removeInventoyListener(this); if (!invInstances.empty()) invInstances.front()->updateDropButton(); @@ -681,7 +682,10 @@ void InventoryWindow::close() else { if (Net::getInventoryHandler()) + { Net::getInventoryHandler()->closeStorage(Inventory::STORAGE); + Net::getInventoryHandler()->forgotStorage(); + } scheduleDelete(); } } @@ -806,3 +810,14 @@ void InventoryWindow::setVisible(bool visible) mSortDropDown->hideDrop(); Window::setVisible(visible); } + +void InventoryWindow::unsetInventory() +{ + if (mInventory) + { + mInventory->removeInventoyListener(this); + if (mItems) + mItems->unsetInventory(); + } + mInventory = nullptr; +} -- cgit v1.2.3-60-g2f50