[glib: 1/2] gfile: Clarify refcount handling for g_file_replace_contents_bytes_async()
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/2] gfile: Clarify refcount handling for g_file_replace_contents_bytes_async()
- Date: Wed, 14 Oct 2020 11:45:49 +0000 (UTC)
commit 2996d0d68987d4f829c87c1e86d42d303b753e1e
Author: Philip Withnall <pwithnall endlessos org>
Date: Wed Oct 14 11:50:42 2020 +0100
gfile: Clarify refcount handling for g_file_replace_contents_bytes_async()
This introduces no functional changes, but makes the refcount handling a
little easier to follow by no longer splitting a ref/unref pair across
three callbacks. Now, the ref/unref pairs are all within function-local
scopes.
Coverity CID: #1430783
Signed-off-by: Philip Withnall <pwithnall endlessos org>
gio/gfile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gio/gfile.c b/gio/gfile.c
index 6e3b524f7..f92c07612 100644
--- a/gio/gfile.c
+++ b/gio/gfile.c
@@ -7580,7 +7580,6 @@ replace_contents_close_callback (GObject *obj,
/* Ignore errors here, we're only reading anyway */
g_output_stream_close_finish (stream, close_res, NULL);
- g_object_unref (stream);
if (!data->failed)
{
@@ -7662,6 +7661,7 @@ replace_contents_open_callback (GObject *obj,
g_task_get_cancellable (data->task),
replace_contents_write_callback,
data);
+ g_object_unref (stream); /* ownership is transferred to the write_async() call above */
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]