filter-blur: Don't throw exceptions into C code

It is extremely problematic to throw C++ exceptions into C code, especially because C code usually does not handle C++ exceptions at all. Therefore we have to prevent any exception from leaving the function and define it as noexcept.
This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2019-09-04 20:43:40 +02:00
parent 4ab609015c
commit f65dfcbbf0
2 changed files with 5 additions and 3 deletions

View file

@ -393,8 +393,7 @@ bool filter::blur::blur_instance::apply_mask_parameters(std::shared_ptr<gs::effe
} }
bool filter::blur::blur_instance::modified_properties(void*, obs_properties_t* props, obs_property* prop, bool filter::blur::blur_instance::modified_properties(void*, obs_properties_t* props, obs_property* prop,
obs_data_t* settings) obs_data_t* settings) noexcept try {
{
obs_property_t* p; obs_property_t* p;
const char* propname = obs_property_name(prop); const char* propname = obs_property_name(prop);
const char* vtype = obs_data_get_string(settings, ST_TYPE); const char* vtype = obs_data_get_string(settings, ST_TYPE);
@ -552,6 +551,9 @@ bool filter::blur::blur_instance::modified_properties(void*, obs_properties_t* p
} }
return true; return true;
} catch (...) {
P_LOG_ERROR("Unexpected exception in modified_properties callback.");
return false;
} }
void filter::blur::blur_instance::translate_old_settings(obs_data_t* settings) void filter::blur::blur_instance::translate_old_settings(obs_data_t* settings)

View file

@ -161,7 +161,7 @@ namespace filter {
gs_texture_t* blurred_texture); gs_texture_t* blurred_texture);
static bool modified_properties(void* ptr, obs_properties_t* props, obs_property* prop, static bool modified_properties(void* ptr, obs_properties_t* props, obs_property* prop,
obs_data_t* settings); obs_data_t* settings) noexcept;
void translate_old_settings(obs_data_t*); void translate_old_settings(obs_data_t*);