libnm-glib: fix up empty object path demarshalling after 8afce8590a

G_VALUE_HOLDS will fail if the value variable is NULL, so we only
want to check that the GValue holds the right type if the value
is valid.  NULL means "no object path" in demarshallers.
This commit is contained in:
Dan Williams
2011-06-01 12:52:20 -05:00
parent a70d87d84e
commit 10ea7a911c
3 changed files with 25 additions and 25 deletions

View File

@@ -637,12 +637,10 @@ demarshal_active_ap (NMObject *object, GParamSpec *pspec, GValue *value, gpointe
NMAccessPoint *ap = NULL;
DBusGConnection *connection;
if (!G_VALUE_HOLDS (value, DBUS_TYPE_G_OBJECT_PATH))
return FALSE;
priv->got_active_ap = TRUE;
if (value) {
if (!G_VALUE_HOLDS (value, DBUS_TYPE_G_OBJECT_PATH))
return FALSE;
path = g_value_get_boxed (value);
if (path) {
ap = NM_ACCESS_POINT (_nm_object_cache_get (path));
@@ -653,6 +651,8 @@ demarshal_active_ap (NMObject *object, GParamSpec *pspec, GValue *value, gpointe
}
}
priv->got_active_ap = TRUE;
if (priv->active_ap) {
g_object_unref (priv->active_ap);
priv->active_ap = NULL;

View File

@@ -628,12 +628,10 @@ demarshal_active_nsp (NMObject *object, GParamSpec *pspec, GValue *value, gpoint
NMWimaxNsp *nsp = NULL;
DBusGConnection *connection;
if (!G_VALUE_HOLDS (value, DBUS_TYPE_G_OBJECT_PATH))
return FALSE;
priv->got_active_nsp = TRUE;
if (value) {
if (!G_VALUE_HOLDS (value, DBUS_TYPE_G_OBJECT_PATH))
return FALSE;
path = g_value_get_boxed (value);
if (path) {
nsp = NM_WIMAX_NSP (_nm_object_cache_get (path));
@@ -644,6 +642,8 @@ demarshal_active_nsp (NMObject *object, GParamSpec *pspec, GValue *value, gpoint
}
}
priv->got_active_nsp = TRUE;
if (priv->active_nsp) {
g_object_unref (priv->active_nsp);
priv->active_nsp = NULL;

View File

@@ -120,12 +120,10 @@ demarshal_ip4_config (NMObject *object, GParamSpec *pspec, GValue *value, gpoint
NMIP4Config *config = NULL;
DBusGConnection *connection;
if (!G_VALUE_HOLDS (value, DBUS_TYPE_G_OBJECT_PATH))
return FALSE;
priv->got_ip4_config = TRUE;
if (value) {
if (!G_VALUE_HOLDS (value, DBUS_TYPE_G_OBJECT_PATH))
return FALSE;
path = g_value_get_boxed (value);
if (path) {
config = NM_IP4_CONFIG (_nm_object_cache_get (path));
@@ -136,6 +134,8 @@ demarshal_ip4_config (NMObject *object, GParamSpec *pspec, GValue *value, gpoint
}
}
priv->got_ip4_config = TRUE;
if (priv->ip4_config) {
g_object_unref (priv->ip4_config);
priv->ip4_config = NULL;
@@ -156,12 +156,10 @@ demarshal_dhcp4_config (NMObject *object, GParamSpec *pspec, GValue *value, gpoi
NMDHCP4Config *config = NULL;
DBusGConnection *connection;
if (!G_VALUE_HOLDS (value, DBUS_TYPE_G_OBJECT_PATH))
return FALSE;
priv->got_dhcp4_config = TRUE;
if (value) {
if (!G_VALUE_HOLDS (value, DBUS_TYPE_G_OBJECT_PATH))
return FALSE;
path = g_value_get_boxed (value);
if (path) {
config = NM_DHCP4_CONFIG (_nm_object_cache_get (path));
@@ -172,6 +170,8 @@ demarshal_dhcp4_config (NMObject *object, GParamSpec *pspec, GValue *value, gpoi
}
}
priv->got_dhcp4_config = TRUE;
if (priv->dhcp4_config) {
g_object_unref (priv->dhcp4_config);
priv->dhcp4_config = NULL;
@@ -192,12 +192,10 @@ demarshal_ip6_config (NMObject *object, GParamSpec *pspec, GValue *value, gpoint
NMIP6Config *config = NULL;
DBusGConnection *connection;
if (!G_VALUE_HOLDS (value, DBUS_TYPE_G_OBJECT_PATH))
return FALSE;
priv->got_ip6_config = TRUE;
if (value) {
if (!G_VALUE_HOLDS (value, DBUS_TYPE_G_OBJECT_PATH))
return FALSE;
path = g_value_get_boxed (value);
if (path) {
config = NM_IP6_CONFIG (_nm_object_cache_get (path));
@@ -208,6 +206,8 @@ demarshal_ip6_config (NMObject *object, GParamSpec *pspec, GValue *value, gpoint
}
}
priv->got_ip6_config = TRUE;
if (priv->ip6_config) {
g_object_unref (priv->ip6_config);
priv->ip6_config = NULL;