summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-10-16 15:05:01 +0200
committerThomas Haller <thaller@redhat.com>2018-10-17 16:22:34 +0200
commit127ac25ef8ddd08a78a4fa8b17df35c528b7a48c (patch)
tree151f067616e2505b792f8eb42755aa0d9ae6b353
parenta600b3a3b26660ad519ed2ffb0c0cd1d0f41df08 (diff)
downloadNetworkManager-127ac25ef8ddd08a78a4fa8b17df35c528b7a48c.tar.gz
cli: fix setting "serial.parity" enum
The meta data type descriptor must set .get_gtype only for GObject properties which are of type int or uint. That is, when the enum type cannot be automatically detected. However, NM_SETTING_SERIAL_PARITY is a g_param_spec_enum() of type NM_TYPE_SETTING_SERIAL_PARITY, so setting the get_gtype() hook is wrong and leads to a crash $ /bin/nmcli connection add type gsm autoconnect no con-name t ifname '*' apn xyz serial.parity 5 (process:11086): libnmc-CRITICAL **: 15:04:35.180: file clients/common/nm-meta-setting-desc.c: line 1283 (_set_fcn_gobject_enum): should not be reached Segmentation fault (core dumped) That is because the enum property setter does: »···if ( has_gtype »··· && NM_IN_SET (gtype_prop, »··· G_TYPE_INT, »··· G_TYPE_UINT) »··· && G_TYPE_IS_CLASSED (gtype) »··· && (gtype_class = g_type_class_ref (gtype)) »··· && ( (is_flags = G_IS_FLAGS_CLASS (gtype_class)) »··· || G_IS_ENUM_CLASS (gtype_class))) { »···»···/* valid */ meaning, it only allows "has_gtype" if the native "gtype_prop" is G_TYPE_INT or G_TYPE_UINT. Fixes: 9a68123827a8c4fe1eeaaf003d365429441d97e9
-rw-r--r--clients/common/nm-meta-setting-desc.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c
index bd58e31370..9048e927a6 100644
--- a/clients/common/nm-meta-setting-desc.c
+++ b/clients/common/nm-meta-setting-desc.c
@@ -7152,7 +7152,6 @@ static const NMMetaPropertyInfo *const property_infos_SERIAL[] = {
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
- .get_gtype = nm_setting_serial_parity_get_type,
.value_infos = ENUM_VALUE_INFOS (
{
.value = NM_SETTING_SERIAL_PARITY_EVEN,