Compare commits

..

1 Commits

Author SHA1 Message Date
hecomi
f7eba2434f fix bug #2 that causes crash after returning from UAC. 2016-11-24 23:38:07 +09:00
2 changed files with 25 additions and 3 deletions

View File

@@ -113,10 +113,11 @@ void Monitor::Render(UINT timeout)
{
if (!deskDupl_) return;
HRESULT hr;
ComPtr<IDXGIResource> resource;
DXGI_OUTDUPL_FRAME_INFO frameInfo;
const auto hr = deskDupl_->AcquireNextFrame(timeout, &frameInfo, &resource);
hr = deskDupl_->AcquireNextFrame(timeout, &frameInfo, &resource);
if (FAILED(hr))
{
switch (hr)
@@ -191,9 +192,30 @@ void Monitor::Render(UINT timeout)
UpdateMetadata(frameInfo);
UpdateCursor(frameInfo);
if (FAILED(deskDupl_->ReleaseFrame()))
hr = deskDupl_->ReleaseFrame();
if (FAILED(hr))
{
Debug::Error("Monitor::Render() => ReleaseFrame() failed.");
switch (hr)
{
case DXGI_ERROR_ACCESS_LOST:
{
Debug::Log("Monitor::Render() => DXGI_ERROR_ACCESS_LOST.");
state_ = State::AccessLost;
break;
}
case DXGI_ERROR_INVALID_CALL:
{
Debug::Error("Monitor::Render() => DXGI_ERROR_INVALID_CALL.");
break;
}
default:
{
state_ = State::Unknown;
Debug::Error("Monitor::Render() => Unknown Error.");
break;
}
}
return;
}
}