[PATCH 2/2] modem-manager: workaround issue in 'GDBusObjectManagerClient'



The 'GDBusObjectManagerClient' won't signal added or removed objects when it
was created but no name owner was available in the bus. We can still use it for
name-owner changes, but in order to have added/removed object signals, we'll
need to re-create the whole 'MMManager' when we know the service came alive in
the bus.

See GLib/GIO/GDBus bug:
   https://bugzilla.gnome.org/show_bug.cgi?id=693285
---
 src/modem-manager/nm-modem-manager.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/modem-manager/nm-modem-manager.c b/src/modem-manager/nm-modem-manager.c
index ce74920..e0c6733 100644
--- a/src/modem-manager/nm-modem-manager.c
+++ b/src/modem-manager/nm-modem-manager.c
@@ -540,6 +540,7 @@ modem_manager_1_available (NMModemManager *self)
 
 static void schedule_modem_manager_1_relaunch (NMModemManager *self,
                                                guint n_seconds);
+static void ensure_client                     (NMModemManager *self);
 
 static void
 modem_manager_1_name_owner_changed (MMManager *modem_manager_1,
@@ -563,7 +564,18 @@ modem_manager_1_name_owner_changed (MMManager *modem_manager_1,
 
 	/* Available! */
 	g_free (name_owner);
-	modem_manager_1_available (self);
+
+	/* Hack alert: GDBusObjectManagerClient won't signal neither 'object-added'
+	 * nor 'object-removed' if it was created while there was no ModemManager in
+	 * the bus. This hack avoids this issue until we get a GIO with the fix
+	 * included... */
+	modem_manager_1_clear_signals (self);
+	g_clear_object (&self->priv->modem_manager_1);
+	ensure_client (self);
+
+	/* Whenever GDBusObjectManagerClient is fixed, we can just do the following:
+	 * modem_manager_1_available (self);
+	 */
 }
 
 static void
-- 
1.8.1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]