Fix startup crash when a texture file fails to load on an async worker thread - #3
Open
scottsheppeard wants to merge 1 commit into
Open
Conversation
r_tex_c::LoadFile()'s failed-load fallback (missing or unreadable file) called Upload() directly from the texture manager's worker thread. The GL context belongs to the main thread, so this crashes in ANGLE's GL_GenTextures with a null-deref (observed as a startup SIGSEGV on macOS when the PoB passive tree references TreeData/PassiveMasteryConnectedButton.png, which does not exist). Route the placeholder upload through the pending-upload queue exactly like the successful async load path a few lines above, so the main thread performs the GL work in ProcessPendingTextureUploads(). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
Running a current PathOfBuilding
devcheckout through the dev-mode launcher segfaults during startup on Apple Silicon:Trigger: PoB's passive tree sprite loading references
TreeData/PassiveMasteryConnectedButton.png, which doesn't exist in the repo.r_tex_c::LoadFile()'s failed-load fallback uploads the placeholder texture by callingUpload()directly on the texture manager worker thread. The GL context is only current on the main thread, so ANGLE'sGL_GenTexturesnull-derefs.The successful async load path a few lines above already handles this correctly by enqueueing via
manager->EnqueueTextureUpload()so the main thread performs the GL work inProcessPendingTextureUploads()— the fallback path just predates/bypasses that mechanism.Fix
When
TF_ASYNCis set, route the placeholder through the same pending-upload queue; the synchronous path is unchanged.flagsis reset toTF_NOMIPMAPbefore enqueueing to preserve the previousUpload(*raw, TF_NOMIPMAP)GL behaviour.Verified on an M-series MacBook Pro: previously crashed deterministically at startup with both the PoE1 and PoE2 dev trees; with this patch both start and run normally (missing file degrades to the default placeholder texture, as on Windows).
Note: the same code exists in upstream
PathOfBuildingCommunity/PathOfBuilding-SimpleGraphicmaster — I'm submitting the same fix there; if it merges upstream first, feel free to close this one in favour of a sync.🤖 Generated with Claude Code