From 9ae8ecc3e1b1b6aac3829653cccf626ae7c02f66 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Mon, 9 Apr 2018 13:23:57 +0200 Subject: [PATCH] source-mirror: Fix crashes caused by uncaught exception --- source/source-mirror.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/source/source-mirror.cpp b/source/source-mirror.cpp index a947fe8..ce29a2f 100644 --- a/source/source-mirror.cpp +++ b/source/source-mirror.cpp @@ -124,7 +124,7 @@ static void UpdateSourceList(obs_property_t* p) { obs_enum_sources(UpdateSourceListCB, p); } -obs_properties_t * Source::MirrorAddon::get_properties(void *ptr) { +obs_properties_t * Source::MirrorAddon::get_properties(void *) { obs_properties_t* pr = obs_properties_create(); obs_property_t* p = nullptr; @@ -312,7 +312,7 @@ void Source::Mirror::video_tick(float) { m_mirrorName = obs_source_get_name(m_mirrorSource->get_object()); } -void Source::Mirror::video_render(gs_effect_t* effect) { +void Source::Mirror::video_render(gs_effect_t* ) { if ((m_width == 0) || (m_height == 0) || !m_mirrorSource) { return; } @@ -323,7 +323,12 @@ void Source::Mirror::video_render(gs_effect_t* effect) { sh = obs_source_get_height(m_mirrorSource->get_object()); // Store original Source Texture - std::shared_ptr tex = m_mirrorSource->render(sw, sh); + std::shared_ptr tex; + try { + tex = m_mirrorSource->render(sw, sh); + } catch (...) { + return; + } gs_eparam_t *scale_param = gs_effect_get_param_by_name(m_scalingEffect, "base_dimension_i"); if (scale_param) {