mirror of
https://github.com/SKCraft/Launcher.git
synced 2024-11-27 12:46:22 +01:00
2a50a19d73
If for any reason the document associated with a LimitLinesDocumentListener ended up not getting shorter when its first line was removed (this is, of course, impossible), sklauncher would wedge in a busy loop that completely killed the GUI thread forever. Solution, part #1: Don't do a while loop, just remove multiple lines if you need to. But wait, why are we having this problem at all? It turns out that there are problems when the document's length changes, which can manifest as tons of BadLocationExceptions going uncaught in the AWT thread which is trying to refresh the window. Why? Probably because the insert into the document isn't happening in the Swing run queue, but concurrently with it. So use an invokeLater to do the actual insertion. With these two changes, and a console set to 125 lines, I got no failures. Previously, if I set the console to 125 lines, it would die catastrophically before Minecraft was done starting up. Also performance may be noticably better. It's pretty common for things to dump 20+ lines into the buffer at once. If you have a 10,000 line buffer, and you then delete the first line of it 20 times, that's actually a whole lot of allocation and shuffling going on. |
||
---|---|---|
.. | ||
src/main | ||
build.gradle |