FAForever / downlords-faf-client

Official client for Forged Alliance Forever
https://faforever.com
MIT License
194 stars 119 forks source link

Overhaul Client State Handling #3050

Closed Sheikah45 closed 7 months ago

Sheikah45 commented 8 months ago

Currently the client maintains most state in the various UI controllers. This results in the view elements needing to be cached so as to not lose state. This is suboptimal because it has lead to memory leaks where some ui elements cannot be garbage collected even when they are removed from the scene.

Additionally there is no cleanup of elements and their listeners when they are removed from the UI which also contributes to memory leaks.

This PR aims to overhaul the state maintenance of the client such that views are just displays and can be created and discarded at will.

Tasks

Closes #2994 Closes #3016 Closes #3018

codecov[bot] commented 8 months ago

Codecov Report

Merging #3050 (f9cceb2) into develop (7e39b73) will decrease coverage by 0.16%. The diff coverage is 62.59%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #3050 +/- ## ============================================= - Coverage 58.88% 58.72% -0.16% + Complexity 4461 4459 -2 ============================================= Files 558 560 +2 Lines 20201 20458 +257 Branches 1035 1036 +1 ============================================= + Hits 11895 12014 +119 - Misses 7757 7900 +143 + Partials 549 544 -5 ``` | [Files](https://app.codecov.io/gh/FAForever/downlords-faf-client/pull/3050?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FAForever) | Coverage Δ | | |---|---|---| | [...client/achievements/AchievementItemController.java](https://app.codecov.io/gh/FAForever/downlords-faf-client/pull/3050?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FAForever#diff-c3JjL21haW4vamF2YS9jb20vZmFmb3JldmVyL2NsaWVudC9hY2hpZXZlbWVudHMvQWNoaWV2ZW1lbnRJdGVtQ29udHJvbGxlci5qYXZh) | `100.00% <ø> (ø)` | | | [.../main/java/com/faforever/client/api/IceServer.java](https://app.codecov.io/gh/FAForever/downlords-faf-client/pull/3050?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FAForever#diff-c3JjL21haW4vamF2YS9jb20vZmFmb3JldmVyL2NsaWVudC9hcGkvSWNlU2VydmVyLmphdmE=) | `100.00% <100.00%> (ø)` | | | [.../java/com/faforever/client/audio/AudioService.java](https://app.codecov.io/gh/FAForever/downlords-faf-client/pull/3050?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FAForever#diff-c3JjL21haW4vamF2YS9jb20vZmFmb3JldmVyL2NsaWVudC9hdWRpby9BdWRpb1NlcnZpY2UuamF2YQ==) | `100.00% <100.00%> (ø)` | | | [...ava/com/faforever/client/avatar/AvatarService.java](https://app.codecov.io/gh/FAForever/downlords-faf-client/pull/3050?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FAForever#diff-c3JjL21haW4vamF2YS9jb20vZmFmb3JldmVyL2NsaWVudC9hdmF0YXIvQXZhdGFyU2VydmljZS5qYXZh) | `100.00% <100.00%> (+18.18%)` | :arrow_up: | | [...orever/client/chat/ChatCategoryItemController.java](https://app.codecov.io/gh/FAForever/downlords-faf-client/pull/3050?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FAForever#diff-c3JjL21haW4vamF2YS9jb20vZmFmb3JldmVyL2NsaWVudC9jaGF0L0NoYXRDYXRlZ29yeUl0ZW1Db250cm9sbGVyLmphdmE=) | `65.51% <100.00%> (-0.59%)` | :arrow_down: | | [...ava/com/faforever/client/chat/ChatChannelUser.java](https://app.codecov.io/gh/FAForever/downlords-faf-client/pull/3050?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FAForever#diff-c3JjL21haW4vamF2YS9jb20vZmFmb3JldmVyL2NsaWVudC9jaGF0L0NoYXRDaGFubmVsVXNlci5qYXZh) | `93.93% <100.00%> (+4.75%)` | :arrow_up: | | [...om/faforever/client/chat/TrustEveryoneFactory.java](https://app.codecov.io/gh/FAForever/downlords-faf-client/pull/3050?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FAForever#diff-c3JjL21haW4vamF2YS9jb20vZmFmb3JldmVyL2NsaWVudC9jaGF0L1RydXN0RXZlcnlvbmVGYWN0b3J5LmphdmE=) | `25.00% <ø> (ø)` | | | [...r/client/chat/UserListCustomizationController.java](https://app.codecov.io/gh/FAForever/downlords-faf-client/pull/3050?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FAForever#diff-c3JjL21haW4vamF2YS9jb20vZmFmb3JldmVyL2NsaWVudC9jaGF0L1VzZXJMaXN0Q3VzdG9taXphdGlvbkNvbnRyb2xsZXIuamF2YQ==) | `100.00% <ø> (ø)` | | | [...ever/client/chat/emoticons/EmoticonController.java](https://app.codecov.io/gh/FAForever/downlords-faf-client/pull/3050?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FAForever#diff-c3JjL21haW4vamF2YS9jb20vZmFmb3JldmVyL2NsaWVudC9jaGF0L2Vtb3RpY29ucy9FbW90aWNvbkNvbnRyb2xsZXIuamF2YQ==) | `100.00% <ø> (ø)` | | | [...lient/chat/emoticons/EmoticonsGroupController.java](https://app.codecov.io/gh/FAForever/downlords-faf-client/pull/3050?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FAForever#diff-c3JjL21haW4vamF2YS9jb20vZmFmb3JldmVyL2NsaWVudC9jaGF0L2Vtb3RpY29ucy9FbW90aWNvbnNHcm91cENvbnRyb2xsZXIuamF2YQ==) | `100.00% <ø> (ø)` | | | ... and [193 more](https://app.codecov.io/gh/FAForever/downlords-faf-client/pull/3050?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FAForever) | | ... and [20 files with indirect coverage changes](https://app.codecov.io/gh/FAForever/downlords-faf-client/pull/3050/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FAForever) ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/FAForever/downlords-faf-client/pull/3050?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FAForever). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FAForever) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/FAForever/downlords-faf-client/pull/3050?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FAForever). Last update [7e39b73...f9cceb2](https://app.codecov.io/gh/FAForever/downlords-faf-client/pull/3050?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FAForever). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FAForever).