[gnio] Unref GSources after attaching



commit 17a3e8fe70a53dd99c2184942447877736716c93
Author: Alexander Larsson <alexl redhat com>
Date:   Tue May 5 13:33:42 2009 +0200

    Unref GSources after attaching
    
    We're leaking the sources, as they won't be finalized when the
    source is detatched.
---
 gio/gsocketclient.c       |    1 +
 gio/gsocketinputstream.c  |    1 +
 gio/gsocketlistener.c     |    1 +
 gio/gsocketoutputstream.c |    1 +
 4 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/gio/gsocketclient.c b/gio/gsocketclient.c
index 230c2d8..559c8b3 100644
--- a/gio/gsocketclient.c
+++ b/gio/gsocketclient.c
@@ -232,6 +232,7 @@ g_socket_client_enumerator_callback (GObject      *object,
                                  (GSourceFunc) g_socket_client_socket_callback,
                                  data, NULL);
           g_source_attach (source, NULL);
+	  g_source_unref (source);
 
           return;
         }
diff --git a/gio/gsocketinputstream.c b/gio/gsocketinputstream.c
index f469dae..908cbbc 100644
--- a/gio/gsocketinputstream.c
+++ b/gio/gsocketinputstream.c
@@ -190,6 +190,7 @@ g_socket_input_stream_read_async (GInputStream        *stream,
                              (GSourceFunc) g_socket_input_stream_read_ready,
                              g_object_ref (input_stream), g_object_unref);
       g_source_attach (source, NULL);
+      g_source_unref (source);
     }
   else
     {
diff --git a/gio/gsocketlistener.c b/gio/gsocketlistener.c
index eb10529..6f796f5 100644
--- a/gio/gsocketlistener.c
+++ b/gio/gsocketlistener.c
@@ -196,6 +196,7 @@ g_socket_listener_accept_async (GSocketListener     *listener,
                              (GSourceFunc) g_socket_listener_accept_ready,
                              g_object_ref (listener), g_object_unref);
       g_source_attach (source, NULL);
+      g_source_unref (source);
     }
   else
     {
diff --git a/gio/gsocketoutputstream.c b/gio/gsocketoutputstream.c
index a3884e0..20cddce 100644
--- a/gio/gsocketoutputstream.c
+++ b/gio/gsocketoutputstream.c
@@ -190,6 +190,7 @@ g_socket_output_stream_write_async (GOutputStream        *stream,
                              (GSourceFunc) g_socket_output_stream_write_ready,
                              g_object_ref (input_stream), g_object_unref);
       g_source_attach (source, NULL);
+      g_source_unref (source);
     }
   else
     {



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