[gnome-bluetooth/gnome-3-8] sendto: Don't unref object within itself



commit 47f21ff5306262a45aaa60f2eebb044b468cfa89
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Jun 24 16:48:17 2013 +0200

    sendto: Don't unref object within itself
    
    Lose the last reference to the ObexAgent outside the object,
    otherwise we'll get into trouble.

 sendto/main.c       |    4 ++--
 sendto/obex-agent.c |    2 --
 2 files changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/sendto/main.c b/sendto/main.c
index 4846a78..8048ddf 100644
--- a/sendto/main.c
+++ b/sendto/main.c
@@ -544,7 +544,7 @@ static gboolean release_callback(GDBusMethodInvocation *invocation,
 {
        g_dbus_method_invocation_return_value (invocation, NULL);
 
-       agent = NULL;
+       g_clear_object (&agent);
 
        gtk_label_set_markup(GTK_LABEL(label_status), NULL);
 
@@ -570,7 +570,7 @@ static gboolean error_callback(GDBusMethodInvocation *invocation,
 
        if (agent != NULL) {
                obex_agent_set_release_func(agent, NULL, NULL);
-               agent = NULL;
+               g_clear_object (&agent);
        }
 
        g_dbus_method_invocation_return_value (invocation, NULL);
diff --git a/sendto/obex-agent.c b/sendto/obex-agent.c
index 69a5b4d..9122b16 100644
--- a/sendto/obex-agent.c
+++ b/sendto/obex-agent.c
@@ -205,8 +205,6 @@ static gboolean obex_agent_release(ObexAgent *agent,
        else
                g_dbus_method_invocation_return_value (invocation, NULL);
 
-       g_object_unref(agent);
-
        return result;
 }
 


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