Hi,

I believe this bug still exists in libgnetwork-0.0.8-1.

My patch was not applied verbatim, which is obviously a good sign. :-)
However, it appears that the actual fix to the bug was lost in the
shuffle.

This is the relevant part of the diff between 0.0.7 with my original
patch applied (let's call this tree 0.0.7-dbrock) and 0.0.8:

--- libgnetwork-0.0.7-dbrock/libgnetwork/gnetwork-udp-datagram.c        
2005-01-31 02:03:30.000000000 +0100
+++ libgnetwork-0.0.8/libgnetwork/gnetwork-udp-datagram.c       2005-02-07 
11:11:57.000000000 +0100
@@ -708,29 +712,24 @@
 static void
 gnetwork_udp_datagram_close (GNetworkUdpDatagram * udp)
 {
   if (udp->_priv->dgram_status <= GNETWORK_DATAGRAM_CLOSED)
     return;
 
-  if (udp->_priv->source_id != 0)
-    {
-      gnetwork_thread_source_remove (udp->_priv->source_id);
-      udp->_priv->source_cond = 0;
-      udp->_priv->source_id = 0;
-    }
-
   if (udp->_priv->channel != NULL)
     {
+      g_io_channel_shutdown (udp->_priv->channel, FALSE, NULL);
       g_io_channel_unref (udp->_priv->channel);
+      udp->_priv->source_cond = 0;
+      udp->_priv->source_id = 0;
       udp->_priv->channel = NULL;
     }
-
-  if (udp->_priv->sockfd > 0)
+  else if (udp->_priv->sockfd > 0)
     {
       shutdown (udp->_priv->sockfd, SHUT_RDWR);
       close (udp->_priv->sockfd);
-      udp->_priv->sockfd = -1;
     }
 
+  udp->_priv->sockfd = -1;
   udp->_priv->dgram_status = GNETWORK_DATAGRAM_CLOSED;
   g_object_notify (G_OBJECT (udp), "socket");
   g_object_notify (G_OBJECT (udp), "status");

In effect, this addition

+      gnetwork_thread_source_remove (udp->_priv->source_id);

was reverted, and replaced by the following addition,

+      g_io_channel_shutdown (udp->_priv->channel, FALSE, NULL);

which suggests that James believed shutting down a GIOChannel would
automatically cause any attached GSources to be destroyed.  I can't
find any evidence of that being true (although I will admit to a
rather unfamiliarity with the inner workings of GIOChannel and
friends).

One piece of evidence to the contrary would be that the channel was
already being shut down in libgnetwork-0.0.7, because it had the
`close_on_unref' flag set.

Another such piece of evidence is that the code that originally led me
to discover the bug in 0.0.7 (and which works with 0.0.7-dbrock) still
doesn't work with 0.0.8-1, though it does work if you add just the
missing line.


Short version
=============

The statement

      gnetwork_thread_source_remove (udp->_priv->source_id);

still needs to be added.


Thanks,

-- 
Daniel Brockman <[EMAIL PROTECTED]>

P.S.  Please let me know if you think I'm being overly specific, or if
there's something I better do differently.  I haven't done much bug
reporting or collaborative development at all before, so I'm trying to
avoid making a fool out of myself by sending bogus bug reports. :-)


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to