From fb25e0541676f5cfbe7b1601507533c500a11f54 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 27 Aug 2022 17:26:43 +0100 Subject: [PATCH] InventoryManager: fixed current window getting removed in race conditions with close window ACK this could be observed by pressing E and immediately clicking a chest, which, if timed correctly, would lead to the chest lid closing, but the inventory being opened anyway. --- src/network/mcpe/InventoryManager.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/network/mcpe/InventoryManager.php b/src/network/mcpe/InventoryManager.php index 4b7f870f8..7e7891c39 100644 --- a/src/network/mcpe/InventoryManager.php +++ b/src/network/mcpe/InventoryManager.php @@ -259,8 +259,10 @@ class InventoryManager{ public function onClientRemoveWindow(int $id) : void{ if($id === $this->lastInventoryNetworkId){ - $this->remove($id); - $this->player->removeCurrentWindow(); + if($id !== $this->pendingCloseWindowId){ + $this->remove($id); + $this->player->removeCurrentWindow(); + } }else{ $this->session->getLogger()->debug("Attempted to close inventory with network ID $id, but current is $this->lastInventoryNetworkId"); }