libobs: Duplicate URL string for OBS_BUTTON_URL

WidgetInfo::ButtonClicked() is aborting because URL string is not
allocated and eventually free-d by Python. This fix is allocating
a new string to store the URL passed to the Python function
obs_property_button_set_url().

Free button URL

Repace spaces with tabs

Typo
This commit is contained in:
Sergo Pogosyan 2022-04-09 22:44:10 -04:00 committed by Jim
parent 436643c3b9
commit 5582503d4f

View file

@ -169,6 +169,12 @@ static inline void float_data_free(struct float_data *data)
bfree(data->suffix);
}
static inline void button_data_free(struct button_data *data)
{
if (data->url)
bfree(data->url);
}
struct obs_properties;
struct obs_property {
@ -259,6 +265,8 @@ static void obs_property_destroy(struct obs_property *property)
int_data_free(get_property_data(property));
else if (property->type == OBS_PROPERTY_FLOAT)
float_data_free(get_property_data(property));
else if (property->type == OBS_PROPERTY_BUTTON)
button_data_free(get_property_data(property));
bfree(property->name);
bfree(property->desc);
@ -1154,7 +1162,7 @@ void obs_property_button_set_url(obs_property_t *p, char *url)
if (!data)
return;
data->url = url;
data->url = bstrdup(url);
}
void obs_property_list_clear(obs_property_t *p)