I experimented a bit with this, and I have a theory. I think that the selection box is being updated on a mouse move event. The mouse move events are rate limited, for example when making a selection, when dragging the selection box, if you stop the mouse suddenly, the selection box won't match the current mouse position, as the last few movements were not sent as events. The mouse movement event related to updating the selection box is unregistered when the left mouse button is released. I think what is happening is that if a mouse movement event enters the event queue after the left mouse button up, but before the left mouse button up unregisters the mouse move event, then the bug occurs. Basically when the left mouse button is released, the game unregisters the mouse move event, and makes the selection, then resets the start and end points of the selection box to 0,0, then after that happens a queued mouse move event, if queued before the mouse up event fires, can update the end point of the selection box to the current mouse position.
It's also possible that there is a shared mouse move event used by the game, and that it checks the button status of the mouse when fired to determine what it should be doing. If it is checking the status of the mouse buttons at the time when the event is queued, rather than when the event is processed, then it can still cause the same problem. If it is queued after the left mouse button up event, and the left mouse button up event makes the selection and resets the selection box corners, and it is processed as if the left mouse button was down due to that being the state when it was queued, then it can still set the end corner of the selection box.
PS: Actually, the second possible scenario isn't really possible. It would require that a mouse up event for the left mouse button be queued before a mouse move event with the left mouse button down. Unless there is some sort of queue priority which would put the mouse up event first, it should not happen.
< Message edited by Zanthra -- 12/16/2019 2:30:04 AM >