Oops, I got that wrong, it had to be in the first equipped slot (as in your screenshots) for the bug to occur. There's optimization code in place which only checks the inventories for 0 size stacks to remove if an item has been reloaded, and this wasn't being called if there was another item in slot 2.