Skip to content

Commit

Permalink
fix crash bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
hecomi committed May 4, 2021
1 parent 1f3a19d commit 83646bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions Plugins/uWindowCapture/uWindowCapture/WindowsGraphicsCapture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ void WindowsGraphicsCapture::DestroyPoolAndSession()

WindowsGraphicsCapture::~WindowsGraphicsCapture()
{
Stop();
Stop(false);
}


Expand All @@ -237,7 +237,7 @@ void WindowsGraphicsCapture::RequestStop()
}


void WindowsGraphicsCapture::Stop()
void WindowsGraphicsCapture::Stop(bool removeFromManager)
{
hasStopRequested_ = false;
stopTimer_ = 0.f;
Expand All @@ -247,9 +247,12 @@ void WindowsGraphicsCapture::Stop()

DestroyPoolAndSession();

if (const auto& manager = WindowManager::GetWindowsGraphicsCaptureManager())
if (removeFromManager)
{
manager->Remove(shared_from_this());
if (const auto& manager = WindowManager::GetWindowsGraphicsCaptureManager())
{
manager->Remove(shared_from_this());
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class WindowsGraphicsCapture
void SetCallback(const Callback& callback) { callback_ = callback; }
void Start();
void RequestStop();
void Stop();
void Stop(bool removeFromManager = true);
bool ShouldStop() const;
bool IsSessionRestartRequested() const { return isSessionRestartRequested_; }
void Restart();
Expand Down

0 comments on commit 83646bd

Please sign in to comment.