[gupnp/gupnp-1.0] connman-manager: Fix inverse g_strcmp0 checks.
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp/gupnp-1.0] connman-manager: Fix inverse g_strcmp0 checks.
- Date: Sat, 15 Oct 2016 10:13:21 +0000 (UTC)
commit fba7c4eb502f53a76d9837429f328b81363f2ce8
Author: Oliver Tappe <zooey hirschkaefer de>
Date: Mon Jul 27 12:51:40 2015 +0200
connman-manager: Fix inverse g_strcmp0 checks.
* I suppose the checks against name and interface are meant to update
the respective value in the service when they have changed, not when
they stayed the same.
* As the interface of an existing context can't be changed, delete
and re-create the context when the interface of a connman service
changes.
https://bugzilla.gnome.org/show_bug.cgi?id=770318
libgupnp/gupnp-connman-manager.c | 22 ++++++++++------------
1 files changed, 10 insertions(+), 12 deletions(-)
---
diff --git a/libgupnp/gupnp-connman-manager.c b/libgupnp/gupnp-connman-manager.c
index dd70d02..c8f1ba6 100644
--- a/libgupnp/gupnp-connman-manager.c
+++ b/libgupnp/gupnp-connman-manager.c
@@ -230,11 +230,10 @@ on_service_property_signal (GDBusConnection *connection,
g_free (cm_service->iface);
g_variant_lookup (value, "Interface", "s", &cm_service->iface);
- if (cm_service->context != NULL)
- g_object_set (G_OBJECT (cm_service->context),
- "interface",
- cm_service->iface,
- NULL);
+ if (cm_service->context != NULL) {
+ service_context_delete (cm_service);
+ service_context_create (cm_service);
+ }
} else if (g_strcmp0 (name, "State") == 0) {
state_str = g_variant_get_string (value, 0);
@@ -351,7 +350,7 @@ cm_service_update (CMService *cm_service, GVariant *dict, guint port)
(g_strcmp0 (state, "ready") == 0))
new_state = CM_SERVICE_STATE_ACTIVE;
- if (is_name && (g_strcmp0 (cm_service->name, name) == 0)) {
+ if (is_name && (g_strcmp0 (cm_service->name, name) != 0)) {
g_free (cm_service->name);
cm_service->name = name;
@@ -362,15 +361,14 @@ cm_service_update (CMService *cm_service, GVariant *dict, guint port)
NULL);
}
- if (is_iface && (g_strcmp0 (cm_service->iface, iface) == 0)) {
+ if (is_iface && (g_strcmp0 (cm_service->iface, iface) != 0)) {
g_free (cm_service->iface);
cm_service->iface = iface;
- if (cm_service->context != NULL)
- g_object_set (G_OBJECT (cm_service->context),
- "interface",
- cm_service->iface,
- NULL);
+ if (cm_service->context != NULL) {
+ service_context_delete (cm_service);
+ service_context_create (cm_service);
+ }
}
cm_service->port = port;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]