[gnome-bluetooth] Fix crash when obex-client isn't running already



commit ad449a48b80cee46d2f946a27fb814d1b8abbba1
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Dec 14 12:58:31 2009 +0000

    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;
 



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