Backends: Metal: use a dedicated bufferCacheLock to avoid crash#9367
Closed
andygrundman wants to merge 1 commit into
Closed
Backends: Metal: use a dedicated bufferCacheLock to avoid crash#9367andygrundman wants to merge 1 commit into
andygrundman wants to merge 1 commit into
Conversation
…en bufferCache is replaced by a new object while being used for @synchronize(). This also removes the dispatch onto main when adding the finished buffers back into the cache. This operation should be fine to run on any thread as long as it's inside the sync block.
ocornut
pushed a commit
that referenced
this pull request
Apr 14, 2026
…en bufferCache is replaced by a new object while being used for synchronize(). (#9367) This also removes the dispatch onto main when adding the finished buffers back into the cache. This operation should be fine to run on any thread as long as it's inside the sync block.
Owner
|
I'll be dishonest pretending I understand half of what you said and your changes, since I don't know ObjC properly. |
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.
I ran into a crash that was caused by using bufferCache for @synchronized() at the same time as it's replaced by a new object via
self.bufferCache = [survivors mutableCopy];The crash showed up asCollection <__NSArrayM: 0x8c0fd14d0> was mutated while being enumerated.I also removed the dispatch onto main when adding the finished buffers back into the cache. This operation should be fine to run on any thread as long as it's inside the sync block. I also fixed the data type of
double now = GetMachAbsoluteTimeInSeconds();The uint64_t was fine since it only checks once a second, but this felt better since every other time variable is a double/CFTimeInterval.