Description
Describe the bug
Whenever one cancels a chunk deletion process (little window popup with a progress bar, Deleting selection... text and a Cancel button) by clicking Cancel, it shows cancelling... but not only does it get stuck infinitely on that, the cancel button is still clickable after clicking it once, and every time it's clicked, it starts using increasingly higher CPU (until high enough to lock nearly the whole system up). The amount of CPU usage increase seems to be of around one 100% thread (as seen by a roughly 25-30% increase in Win10 Task Manager of the program on a 4 thread i5 where one thread is 25% usage, and a 100% CPU usage increase every time cancel is clicked on MacOS activity monitor where every 100% is one thread worth, e.g. clicking it 10 times makes it 1000% CPU usage).
To Reproduce
Steps to reproduce the behavior:
- Make a selection of chunks/regions in a world, ideally in a larger world and a large selection (to give more time to be able to click the cancel button when deleting during the process, in case it's able to finish)
- Select to delete selected chunks and confirm deletion
- In the little window popping up showing the progress of deleting chunks, click cancel
- It gets stuck on infinite loop of cancelling... while increasing CPU usage by a full thread worth of CPU% every time the Cancel button is clicked. In my case there's also an issue (with a potentially large world and/or selection) where the deletion process hangs when it technically finishes, but even if it's not an issue and deleting can be successfully done and cancelling is also able to actually finish, there's still an issue that the Cancel button can be clicked after clicking it once and it seems to spawn a task that starts the cancellation process every time it's clicked.
Expected behavior
I'd say the most straightforward thing (besides any other potential issues I've seen like the cancellation not finishing, but that's possibly related to how my deletion process also never completes and locks up at the end) would be that once you click the Cancel button in the deletion progress window, the button should be disabled so it can't be clicked again, preventing any further issues that arise from that.
Environment (please complete the following information):
- OS: Windows 10 (x64 build 19042 / 20H2 update, 4c/4t 16GB RAM) and MacOS 11.4 (on 6c/12t 16GB RAM)
- Java version: On Windows tried with the Windows 1.16.1 Installer and the Java it includes with it, and also the universal jar with the JRE-FX-16 bundle (zulu16.30.15-ca-fx-jre16.0.1-win_x64), on MacOS with the JDK-FX-16 bundle (zulu16.30.15-ca-fx-jdk16.0.1-macosx_x64)
- Version 1.16.1
Additional context
Add any other context about the problem here, e.g.:
- 1.16.5 Minecraft world
- Extra chunks pre-generated in the world with Chunky (https://papermc.io/forums/t/1-13-2-1-16-5-chunky-pregenerator/4850)