Package: libgnetwork1.0-0
Version: 0.0.7-1
Severity: important
Tags: patch

When a GNetworkUdpDatagram is explicitly closed, its GLib IO source is
left active with a callback whose user data is the datagram object, yet
the callback does not hold a reference to the object.  This becomes a
serious problem when the IO source for a datagram invokes its callback
after the datagram object has been finalized.

I believe the solution is to simply remove the IO source when a UDP
datagram is explicitly closed.  This already happens when a UDP datagram
is closed as the result of an error.


-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.7-drlion-8
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages libgnetwork1.0-0 depends on:
ii  gconf2                      2.8.1-4      GNOME configuration database syste
ii  libc6                       2.3.2.ds1-18 GNU C Library: Shared libraries an
ii  libgconf2-4                 2.8.1-4      GNOME configuration database syste
ii  libglib2.0-0                2.6.1-2      The GLib library of C routines
ii  libgnutls11                 1.0.16-9     GNU TLS library - runtime library
ii  liborbit2                   1:2.10.2-1.1 libraries for ORBit2 - a CORBA ORB

-- no debconf information
--- libgnetwork-0.0.7.orig/libgnetwork/gnetwork-udp-datagram.c
+++ libgnetwork-0.0.7/libgnetwork/gnetwork-udp-datagram.c
@@ -708,9 +708,16 @@
 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_unref (udp->_priv->channel);
--- libgnetwork-0.0.7.orig/ChangeLog
+++ libgnetwork-0.0.7/ChangeLog
@@ -1,3 +1,8 @@
+2005-01-31  Daniel Brockman  <[EMAIL PROTECTED]>
+
+       * libgnetwork/gnetwork-udp-datagram.c
+       (gnetwork_udp_datagram_close): Remove the IO source.
+
 2004-12-24  James M. Cape  <[EMAIL PROTECTED]>
 
        * .cvsignore: Alphabetized, added a bunch more autotools stuff.

Reply via email to