Fixed a failed font load leaving the text renderer destroyed - #6627
Closed
dekrom wants to merge 1 commit into
Closed
Fixed a failed font load leaving the text renderer destroyed#6627dekrom wants to merge 1 commit into
dekrom wants to merge 1 commit into
Conversation
Collaborator
|
the reasoning here is incorrect, a recursive also, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change
Description
Fonts#loaddestroys the current renderer before it has a replacement:If the constructor throws, the catch falls back to
load(DEFAULT_FONT). That recursive callsees
RENDERER != nulland comparesRENDERER.fontFaceagainstDEFAULT_FONT.FontFacedoesnot override
equalsandFontFamily#gethands back the same stored instance, so when the fontyou were already on was the default, that check passes and the call returns immediately.
RENDERERis left pointing at the renderer that was destroyed a few lines earlier, with allfive of its textures closed.
Every Meteor text draw after that throws out of
CustomTextRenderer#endwhengetTextureView()is called on a closed texture, so the whole gui is unusable until a restart.CustomFontChangedEventis never posted either, so anything caching a font holder keeps thedead one.
Hitting it only takes picking a system font whose file has been moved or deleted since the
startup scan, which is normal enough after a font package update.
Building the new renderer first and only destroying the old one once that succeeded also makes
the early return correct rather than dangerous: on the fallback path
RENDERERis still thelive renderer, so returning early because it is already the default font is exactly right.
Related issues
None that I found.
How Has This Been Tested?
Not reproduced in game yet. The path is easy to follow though: the recursive
load(DEFAULT_FONT)hits the identity check against a renderer that was already destroyed, since
FontFacedoes notoverride
equals. Builds clean against current master.Checklist: