提交 71d54516 编写于 作者: J jpark37 提交者: Jim

libobs-winrt: Fix potential race crash

CreateForWindow can fail if the window is destroyed.
上级 7f5013cf
......@@ -336,11 +336,15 @@ try {
activation_factory.as<IGraphicsCaptureItemInterop>();
winrt::Windows::Graphics::Capture::GraphicsCaptureItem item = {nullptr};
try {
interop_factory->CreateForWindow(
hr = interop_factory->CreateForWindow(
window,
winrt::guid_of<ABI::Windows::Graphics::Capture::
IGraphicsCaptureItem>(),
reinterpret_cast<void **>(winrt::put_abi(item)));
if (FAILED(hr)) {
blog(LOG_ERROR, "CreateForWindow (0x%08X)", hr);
return nullptr;
}
} catch (winrt::hresult_error &err) {
blog(LOG_ERROR, "CreateForWindow (0x%08X): %ls", err.to_abi(),
err.message().c_str());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册