[glib] socket: actually remove fd from poll when socket is closed



commit 4b078694623eb8c07540a4b210be851dd36554d1
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Tue Oct 24 19:52:17 2017 -0500

    socket: actually remove fd from poll when socket is closed
    
    In my previous patch, I failed to call g_source_remove_unix_fd() in
    order to actually stop polling the fd of the closed socket.
    
    The test did not catch this, because the test only checks that the right
    source callback is dispatched properly. I don't know how to test this.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=723655

 gio/gsocket.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/gio/gsocket.c b/gio/gsocket.c
index 42c73e6..567b480 100644
--- a/gio/gsocket.c
+++ b/gio/gsocket.c
@@ -3796,6 +3796,8 @@ socket_source_dispatch (GSource     *source,
 #else
   if (g_socket_is_closed (socket_source->socket))
     {
+      if (socket_source->fd_tag)
+        g_source_remove_unix_fd (source, socket_source->fd_tag);
       socket_source->fd_tag = NULL;
       events = G_IO_NVAL;
     }


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