title: Direct3D11 crash and/or glitches on resizing window
body: <p>I am currently porting a rendering engine from OpenGL to Direct3D11</p>
  <p>Its working fine on my development machine, but having now released it to a few beta testers, 2 testers are reporting a problem on resizing the window (one a crash, the other UI freezing).  As it works on my machine, and I cant see anything wrong in the code, I hope someone with more Direct3D experience might be able to spot what I'm doing wrong.</p>
  <p>Code below is the relevant code what happens when the window resizes (the m_stencilview etc are smart pointers to Com objects, D3D_CHECK is a macro wrapper for checking the result)</p>
  <pre><code>m_stencilview.Clear();
  
  m_stencil.Clear();
  
  m_rendertargetview.Clear();
  
  
  ctx.OMSetRenderTargets(0, 0, 0);
      
  D3D_CHECK(m_swpchain-&gt;ResizeBuffers(0, 0, 0, DXGI_FORMAT_UNKNOWN, 0));
     
  
  ComPtr &lt;ID3D11Texture2D&gt; framebuffer;
  
  D3D_CHECK(m_swpchain-&gt;GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)&amp;framebuffer));
  
  D3D_CHECK(engine.m_device-&gt;CreateRenderTargetView(framebuffer, 0, &amp;m_rendertargetview));
  </code></pre>