gobject: Add g_{param_spec,signal}_is_valid_name() functions

Making this validation code public allows projects to validate a
GParamSpec name before creating it. While hard-coded GParamSpec don't
need this, we can't afford crashing the main program for dynamically
generated GParamSpec from user-created data.

In such case, we will need to validate the param names and return errors
instead of trying to create a GParamSpec with invalid names.

Includes modifications from Philip Withnall and Emmanuele Bassi to
rearrange the new function addition and split it into one function for
GParamSpecs and one for GSignals.
This commit is contained in:
Jehan
2019-12-23 18:36:21 +01:00
committed by Philip Withnall
parent fb1e416a32
commit 13d1697b67
7 changed files with 104 additions and 33 deletions

View File

@@ -521,6 +521,7 @@ g_param_value_defaults
g_param_value_validate
g_param_value_convert
g_param_values_cmp
g_param_spec_is_valid_name
g_param_spec_get_name
g_param_spec_get_name_quark
g_param_spec_get_nick
@@ -859,6 +860,7 @@ g_signal_override_class_handler
g_signal_chain_from_overridden_handler
g_signal_add_emission_hook
g_signal_remove_emission_hook
g_signal_is_valid_name
g_signal_parse_name
g_signal_get_invocation_hint
g_signal_type_cclosure_new