Skip to content

Commit

Permalink
Make OnDraw a bit safer to avoid crashing on exiting OBS
Browse files Browse the repository at this point in the history
  • Loading branch information
OsirisNL committed Apr 13, 2017
1 parent 0e4c9e8 commit d252aee
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions obs-browser/browser-source-listener-base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,20 @@ void BrowserSource::Impl::Listener::OnDraw( BrowserSurfaceHandle surfaceHandle,
UNUSED_PARAMETER(height);

if (textureSet.count(surfaceHandle) > 0) {

obs_enter_graphics();
if (browserSource->GetParent()->TryLockTexture()) {
if (popupSurface != nullptr)
gs_copy_texture_region(surfaceHandle, popupX, popupY, popupSurface, 0, 0, gs_texture_get_width(popupSurface), gs_texture_get_height(popupSurface));
browserSource->SetActiveTexture(surfaceHandle);
browserSource->GetParent()->UnlockTexture();
if (browserSource)
{
if (browserSource->GetParent())
{
if (browserSource->GetParent()->TryLockTexture()) {
if (popupSurface != nullptr)
gs_copy_texture_region(surfaceHandle, popupX, popupY, popupSurface, 0, 0, gs_texture_get_width(popupSurface), gs_texture_get_height(popupSurface));
browserSource->SetActiveTexture(surfaceHandle);
browserSource->GetParent()->UnlockTexture();
}
}
}
obs_leave_graphics();

}
else {
blog(LOG_ERROR, "Asked to draw unknown surface with handle"
Expand Down

0 comments on commit d252aee

Please sign in to comment.