Skip to content

Commit 4e3d9e8

Browse files
committed
fix crash bug caused when Windows Graphics Capture is selected but the window doesn't supports it.
1 parent a7ffcf6 commit 4e3d9e8

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Plugins/uWindowCapture/uWindowCapture/WindowTexture.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ WindowTexture::WindowTexture(Window* window)
1818
{
1919
if (window_->IsDesktop())
2020
{
21-
captureMode_ = CaptureMode::Auto;
2221
windowsGraphicsCapture_ = std::make_shared<WindowsGraphicsCapture>(window_->GetMonitorHandle());
2322
}
2423
else if (window_->IsAltTab())
@@ -199,12 +198,6 @@ bool WindowTexture::CaptureByWin32API()
199198
dpiScaleX_ = std::fmax(static_cast<float>(window_->GetWidth()) / dcWidth, 0.01f);
200199
dpiScaleY_ = std::fmax(static_cast<float>(window_->GetHeight()) / dcHeight, 0.01f);
201200

202-
// Use BitBlt when the target is a Desktop
203-
if (window_->IsDesktop())
204-
{
205-
captureMode_ = CaptureMode::BitBlt;
206-
}
207-
208201
if (GetCaptureModeInternal() == CaptureMode::BitBlt && !window_->IsDesktop())
209202
{
210203
// Remove frame areas
@@ -410,6 +403,8 @@ void WindowTexture::DrawCursorByWin32API(HWND hWnd, HDC hDcMem)
410403

411404
bool WindowTexture::CaptureByWindowsGraphicsCapture()
412405
{
406+
if (!windowsGraphicsCapture_) return false;
407+
413408
if (!windowsGraphicsCapture_->IsStarted())
414409
{
415410
windowsGraphicsCapture_->Start();

0 commit comments

Comments
 (0)