So, my problem is that when I put a bad window handle in the device and swap chain creation, a graphics exception is thrown and the MessageBox pops up, which is good. But, when I move my mouse in the window, the whole program crashes. It happens when the queue of mouse events is trying to call pop when the queue is larger than the max size.
Code: Select all
DXGI_SWAP_CHAIN_DESC sd{};
/*****/
sd.OutputWindow = (HWND)45645; // bad window handle
/*****/
HRESULT hr{};
// exception thrown here
GFX_THROW_INFO(D3D11CreateDeviceAndSwapChain(nullptr,
D3D_DRIVER_TYPE_HARDWARE,
nullptr,
swap_create_flags,
nullptr,
0,
D3D11_SDK_VERSION,
&sd,
&p_swap,
&p_device,
nullptr,
&p_context));
Code: Select all
// inside trimBuffer function of Mouse class
while (buffer.size() > buffer_size)
{
// here it crashes everytime with a read access violation: _Pnext was 0x8
buffer.pop();
}
Anyone knows what's happening?