fix bug caused when releasing duplication output.
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -30,15 +30,15 @@ void Monitor::Initialize(IDXGIOutput* output)
|
|||||||
auto output1 = reinterpret_cast<IDXGIOutput1*>(output);
|
auto output1 = reinterpret_cast<IDXGIOutput1*>(output);
|
||||||
IDXGIOutputDuplication* deskDupl;
|
IDXGIOutputDuplication* deskDupl;
|
||||||
const auto hr = output1->DuplicateOutput(GetDevice(), &deskDupl);
|
const auto hr = output1->DuplicateOutput(GetDevice(), &deskDupl);
|
||||||
deskDupl_ = std::shared_ptr<IDXGIOutputDuplication>(
|
|
||||||
deskDupl,
|
|
||||||
[](IDXGIOutputDuplication* ptr) { ptr->Release(); });
|
|
||||||
|
|
||||||
// TODO: error check
|
// TODO: error check
|
||||||
switch (hr)
|
switch (hr)
|
||||||
{
|
{
|
||||||
case S_OK:
|
case S_OK:
|
||||||
state_ = State::Available;
|
state_ = State::Available;
|
||||||
|
deskDupl_ = std::shared_ptr<IDXGIOutputDuplication>(
|
||||||
|
deskDupl,
|
||||||
|
[](IDXGIOutputDuplication* ptr) { if (ptr != nullptr) ptr->Release(); });
|
||||||
break;
|
break;
|
||||||
case E_INVALIDARG:
|
case E_INVALIDARG:
|
||||||
state_ = State::InvalidArg;
|
state_ = State::InvalidArg;
|
||||||
|
|||||||
Reference in New Issue
Block a user