[gnome-builder] jsonrpc: hold an extra ref during call
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] jsonrpc: hold an extra ref during call
- Date: Mon, 20 Feb 2017 23:37:40 +0000 (UTC)
commit f366cc99e1c524be0c7456a8b35d15d9be980b54
Author: Christian Hergert <chergert redhat com>
Date: Mon Feb 20 15:37:29 2017 -0800
jsonrpc: hold an extra ref during call
Just to be extra safe, we want to hold our own reference to the instance
since we are borrowing the reference.
contrib/jsonrpc-glib/jsonrpc-output-stream.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/contrib/jsonrpc-glib/jsonrpc-output-stream.c b/contrib/jsonrpc-glib/jsonrpc-output-stream.c
index e0b3348..efbfb61 100644
--- a/contrib/jsonrpc-glib/jsonrpc-output-stream.c
+++ b/contrib/jsonrpc-glib/jsonrpc-output-stream.c
@@ -179,7 +179,7 @@ jsonrpc_output_stream_write_message_async_cb (GObject *object,
gpointer user_data)
{
GOutputStream *stream = (GOutputStream *)object;
- JsonrpcOutputStream *self;
+ g_autoptr(JsonrpcOutputStream) self = NULL;
g_autoptr(GError) error = NULL;
g_autoptr(GTask) task = user_data;
GBytes *bytes;
@@ -188,7 +188,8 @@ jsonrpc_output_stream_write_message_async_cb (GObject *object,
g_assert (G_IS_OUTPUT_STREAM (stream));
g_assert (G_IS_ASYNC_RESULT (result));
g_assert (G_IS_TASK (task));
- self = g_task_get_source_object (task);
+
+ self = g_object_ref (g_task_get_source_object (task));
g_assert (JSONRPC_IS_OUTPUT_STREAM (self));
if (!g_output_stream_write_all_finish (stream, result, &n_written, &error))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]