summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--include/io/task.h7
-rw-r--r--io/channel-socket.c3
-rw-r--r--io/channel-tls.c2
-rw-r--r--io/task.c1
-rw-r--r--tests/test-io-task.c1
5 files changed, 4 insertions, 10 deletions
diff --git a/include/io/task.h b/include/io/task.h
index 42028cb424..c268eb0b82 100644
--- a/include/io/task.h
+++ b/include/io/task.h
@@ -244,9 +244,10 @@ void qio_task_abort(QIOTask *task,
  * @task: the task struct
  *
  * Get the source object associated with the background
- * task. This returns a new reference to the object,
- * which the caller must released with object_unref()
- * when no longer required.
+ * task. The caller does not own a reference on the
+ * returned Object, and so should call object_ref()
+ * if it wants to keep the object pointer outside the
+ * lifetime of the QIOTask object.
  *
  * Returns: the source object
  */
diff --git a/io/channel-socket.c b/io/channel-socket.c
index d7e03f6266..45df819a82 100644
--- a/io/channel-socket.c
+++ b/io/channel-socket.c
@@ -168,7 +168,6 @@ static int qio_channel_socket_connect_worker(QIOTask *task,
                                           addr,
                                           errp);
 
-    object_unref(OBJECT(ioc));
     return ret;
 }
 
@@ -231,7 +230,6 @@ static int qio_channel_socket_listen_worker(QIOTask *task,
                                          addr,
                                          errp);
 
-    object_unref(OBJECT(ioc));
     return ret;
 }
 
@@ -309,7 +307,6 @@ static int qio_channel_socket_dgram_worker(QIOTask *task,
                                         data->remoteAddr,
                                         errp);
 
-    object_unref(OBJECT(ioc));
     return ret;
 }
 
diff --git a/io/channel-tls.c b/io/channel-tls.c
index d24dc8c613..cf3bcca7ed 100644
--- a/io/channel-tls.c
+++ b/io/channel-tls.c
@@ -200,8 +200,6 @@ static gboolean qio_channel_tls_handshake_io(QIOChannel *ioc,
     qio_channel_tls_handshake_task(
        tioc, task);
 
-    object_unref(OBJECT(tioc));
-
     return FALSE;
 }
 
diff --git a/io/task.c b/io/task.c
index c7f97a9b16..a763990d47 100644
--- a/io/task.c
+++ b/io/task.c
@@ -156,6 +156,5 @@ void qio_task_abort(QIOTask *task,
 
 Object *qio_task_get_source(QIOTask *task)
 {
-    object_ref(task->source);
     return task->source;
 }
diff --git a/tests/test-io-task.c b/tests/test-io-task.c
index e091c12e10..024eb585e4 100644
--- a/tests/test-io-task.c
+++ b/tests/test-io-task.c
@@ -76,7 +76,6 @@ static void test_task_complete(void)
     g_assert(obj == src);
 
     object_unref(obj);
-    object_unref(src);
 
     g_assert(data.source == obj);
     g_assert(data.err == NULL);