title: Crash on MTLDebugCommandBuffer lockPurgeableObjects in macOS 12 beta
body: <p>We see strange crashes when running our app on <code>macOS 12 beta</code> 21A5522h. We have not been able to fully identify the issue but it seems to happen on continue video playback in an <code>AVPlayer</code> after the app has been in the background. Xcode points to some random code (seems different every time and never in our own code)</p>
  <p><a href="https://i.stack.imgur.com/DwvMS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DwvMS.png" alt="enter image description here" /></a></p>
  <p>And in the log we will see:</p>
  <blockquote>
  <p>-[MTLDebugCommandBuffer lockPurgeableObjects]:2103: failed assertion 'MTLResource 0x600002293790 (label: (null)), referenced in cmd buffer
  0x7f7b2200a000 (label: (null)) is in volatile or empty purgeable state
  at commit'</p>
  <p>-[MTLDebugCommandBuffer lockPurgeableObjects]:2103: failed assertion 'MTLResource 0x600002293790 (label: (null)), referenced in cmd buffer
  0x7f7b2200a000 (label: (null)) is in volatile or empty purgeable state
  at commit'</p>
  </blockquote>
  <p>We tried finding the object 0x600002293790 and 0x7f7b2200a000 but this gave no additional information as to why the app crashes.</p>
  <p>We are using a custom VideoCompositor: <code>AVVideoCompositing</code> and initialise the <code>CIContext</code> for the work done here with these options:</p>
  <pre><code>if let mtlDevice = MTLCreateSystemDefaultDevice() 
      let options: [CIContextOption : Any] = [
          CIContextOption.useSoftwareRenderer: false,
          CIContextOption.outputPremultiplied: false,
      ]
      let context = CIContext(mtlDevice: mtlDevice, options: options)
  }
  </code></pre>
  <p>Not sure this is an Xcode debug issue? or an actual issue as we have not seen it crash when not using Xcode to build our app.</p>
  <p>Any information as to locating the source of the issue or a solution would be awesome.</p>
  <p>Update:</p>
  <p>We seem to see messages before the crash that relate to the screen on most crashes.</p>
  <blockquote>
  <p>****[48028:857651] [] [15:53:06.503] FPSupport_GetDisplayRefreshInformation signalled err=-12780
  (kCMBaseObjectError_ParamErr) (CGDisplayModeGetRefreshRate returned 0)
  at FigPlayerSupport.m:3198</p>
  <p>****[48028:857658] [] [15:53:06.548] customVideoCompositor_CopyProperty signalled err=-12784
  (kFigBaseObjectError_PropertyNotFound) (unrecognised property) at
  FigVideoCompositor_Custom.c:581</p>
  </blockquote>
  <p>Or this one:</p>
  <p><a href="https://i.stack.imgur.com/yKZ6F.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yKZ6F.png" alt="enter image description here" /></a></p>