In some cases the MTLContext was being destroyed before all GPU work was completed causing the (outstanding) command buffer completion event handler to update a command buffer that had already been freed. This behaviour was introduced by [this](https://projects.blender.org/blender/blender/commit/6da42e9c951b) change which updated the event handler to track the number of outstanding command buffers per context as well as system-wide. Reproduced the issue with ASAN enabled and confirmed that waiting for the GPU to complete fixes the issue. Also contains a minor fix for unitiiliased values in MTLAttachments identified by ASAN. Authored by Apple: James McCarthy" Co-authored-by: James McCarthy <jamesmccarthy@apple.com> Pull Request: https://projects.blender.org/blender/blender/pulls/129686