From 9badf033d3ecea4d3bde6bbbb2ac80f389b822ef Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Thu, 12 Oct 2017 10:22:36 +0200 Subject: Send flag that denotes serialization validity Before, we tried to install an existing property if the new property could not been serialized. Now, we always send a property description but denote if it is properly serialized. --- uca-net-camera.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'uca-net-camera.c') diff --git a/uca-net-camera.c b/uca-net-camera.c index 39f591f..f265fc6 100644 --- a/uca-net-camera.c +++ b/uca-net-camera.c @@ -521,15 +521,22 @@ static void read_property_reply (GObject *object, GInputStream *input, guint index, GError **error) { UcaNetMessageProperty property; + GParamSpec *pspec; - if (g_input_stream_read_all (input, &property, sizeof (property), NULL, NULL, error)) { - GParamSpec *pspec; - - pspec = deserialize_param_spec (&property); + if (!g_input_stream_read_all (input, &property, sizeof (property), NULL, NULL, error)) { + g_warning ("Could not read all property data"); + return; + } - if (pspec != NULL) - g_object_class_install_property (G_OBJECT_GET_CLASS (object), N_PROPERTIES + index + 1, pspec); + if (!property.valid) { + g_warning ("Cannot install unserialized property `%s'", property.name); + return; } + + pspec = deserialize_param_spec (&property); + + if (pspec != NULL) + g_object_class_install_property (G_OBJECT_GET_CLASS (object), N_PROPERTIES + index + 1, pspec); } static void -- cgit v1.2.3