From ed95cf3ab7b4ab65127b014a80b971188a3b02da Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Mon, 14 Dec 2009 12:58:31 +0000 Subject: [PATCH 2/2] Fix crash when obex-client isn't running already When obex-client isn't running yet, we can't get a name owner for the service. But we'd still get a callback from the service when trying to use it, and crash trying to compare the sender with a NULL string. Instead, set the owner's dbus name if we don't already have one in obex_agent_request(). See: https://bugzilla.redhat.com/show_bug.cgi?id=544881 --- lib/obex-agent.c | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/obex-agent.c b/lib/obex-agent.c index 38b2fde..276fcb3 100644 --- a/lib/obex-agent.c +++ b/lib/obex-agent.c @@ -78,13 +78,19 @@ static gboolean obex_agent_request(ObexAgent *agent, const char *path, DBG("agent %p sender %s", agent, sender); - if (g_str_equal(sender, priv->busname) == FALSE) { + if (priv->busname == NULL) { + /* When we get called the first time, if OBEX_SERVICE + * was not available, we get its name here */ + priv->busname = sender; + } else { + if (g_str_equal(sender, priv->busname) == FALSE) { + g_free (sender); + return FALSE; + } + g_free (sender); - return FALSE; } - g_free (sender); - if (priv->request_func) { DBusGProxy *proxy; -- 1.6.5.2