Post #390688
2026-02-24 16:55 UTC
Replies (2)
-
@jeang3nie@social.linux.pizza 2026-02-24 17:06
Had some fun little bugs to hunt down while working on #Sunstone last night that show me just how out of practice I am. The DownloadManager widget has a grid-based layout and maintains a list of DownloadRow objects using an ArrayList courtesy of libgee. When the "Clear" button is pressed, the idea was for it to go through the list and remove any DownloadRow objects that are finished, failed, or canceled. It kept crashing. Here's the thing I don't always like about "nice" programming interfaces that give you useful data structures like dynamically sized arrays. The moment you remove an item from an ArrayList, libgee moves all of the other following items back by one. The iterator is now invalidated. The code compiles of course, but it crashes because the internal array is now smaller and it tries to read past the end. I should have understood the problem a lot earlier. I'm rusty because I'm spending so much time on schoolwork, ironically for a computer science degree, that I hardly spend any time programming anymore.
-
@matzipan@hachyderm.io 2026-02-24 16:57
@jeang3nie link returns 404. Is it private?