[maemo-commits] [maemo-commits] r19473 - in projects/haf/trunk/glib/debian: . patches

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Oct 22 16:59:07 EEST 2009
Author: mitch
Date: 2009-10-22 16:59:02 +0300 (Thu, 22 Oct 2009)
New Revision: 19473

Added:
   projects/haf/trunk/glib/debian/patches/22-g-object-unref-toggle-refs.patch
Modified:
   projects/haf/trunk/glib/debian/changelog
   projects/haf/trunk/glib/debian/patches/series
Log:
Add thread-safety patch from bug NB#106135 and release glib2.0 (2.20.3-1maemo3):

glib2.0 (2.20.3-1maemo3) unstable; urgency=low

  [ Michael Natterer ]
  * 22-g-object-unref-toggle-refs.patch: added
    Addresses: NB#140259 - [Random]Telepathy-stream-engine crash during
    Voip call when network is unstable

 -- Michael Natterer <mitch at lanedo.com>  Thu, 22 Oct 2009 16:00:00 +0200



Modified: projects/haf/trunk/glib/debian/changelog
===================================================================
--- projects/haf/trunk/glib/debian/changelog	2009-10-22 11:23:17 UTC (rev 19472)
+++ projects/haf/trunk/glib/debian/changelog	2009-10-22 13:59:02 UTC (rev 19473)
@@ -1,3 +1,12 @@
+glib2.0 (2.20.3-1maemo3) unstable; urgency=low
+
+  [ Michael Natterer ]
+  * 22-g-object-unref-toggle-refs.patch: added
+    Addresses: 140259 - [Random]Telepathy-stream-engine crash during
+    Voip call when network is unstable
+
+ -- Michael Natterer <mitch at lanedo.com>  Thu, 22 Oct 2009 16:00:00 +0200
+
 glib2.0 (2.20.3-1maemo2) unstable; urgency=low
 
   [ Jussi Laako ]

Added: projects/haf/trunk/glib/debian/patches/22-g-object-unref-toggle-refs.patch
===================================================================
--- projects/haf/trunk/glib/debian/patches/22-g-object-unref-toggle-refs.patch	2009-10-22 11:23:17 UTC (rev 19472)
+++ projects/haf/trunk/glib/debian/patches/22-g-object-unref-toggle-refs.patch	2009-10-22 13:59:02 UTC (rev 19473)
@@ -0,0 +1,52 @@
+commit 855deaa5780bfef3f6e8b3a41d00d6c7e40ca406
+Author: Cody Russell <bratsche at gnome.org>
+Date:   Tue Oct 6 12:27:12 2009 -0400
+
+    g_object_unref racy condition can lead to crash
+    
+    Store whether the object has a toggleref before decrementing the
+    refcount to prevent race condition when two threads simultaneously
+    try to unref an object with a refcount of 2.
+    Patch by Antoine Tremblay.
+    
+    https://bugzilla.gnome.org/show_bug.cgi?id=551706
+
+diff --git a/gobject/gobject.c b/gobject/gobject.c
+index 8432488..f906d31 100644
+--- a/gobject/gobject.c
++++ b/gobject/gobject.c
+@@ -2425,11 +2425,14 @@ g_object_unref (gpointer _object)
+   old_ref = g_atomic_int_get (&object->ref_count);
+   if (old_ref > 1)
+     {
++      /* valid if last 2 refs are owned by this call to unref and the toggle_ref */
++      gboolean has_toggle_ref = OBJECT_HAS_TOGGLE_REF (object);
++
+       if (!g_atomic_int_compare_and_exchange ((int *)&object->ref_count, old_ref, old_ref - 1))
+ 	goto retry_atomic_decrement1;
+ 
+       /* if we went from 2->1 we need to notify toggle refs if any */
+-      if (old_ref == 2 && OBJECT_HAS_TOGGLE_REF (object))
++      if (old_ref == 2 && has_toggle_ref) /* The last ref being held in this case is owned by the toggle_ref */
+ 	toggle_refs_notify (object, TRUE);
+     }
+   else
+@@ -2442,13 +2445,16 @@ g_object_unref (gpointer _object)
+       old_ref = g_atomic_int_get ((int *)&object->ref_count);
+       if (old_ref > 1)
+         {
++          /* valid if last 2 refs are owned by this call to unref and the toggle_ref */
++          gboolean has_toggle_ref = OBJECT_HAS_TOGGLE_REF (object);
++
+           if (!g_atomic_int_compare_and_exchange ((int *)&object->ref_count, old_ref, old_ref - 1))
+ 	    goto retry_atomic_decrement2;
+ 
+           /* if we went from 2->1 we need to notify toggle refs if any */
+-          if (old_ref == 2 && OBJECT_HAS_TOGGLE_REF (object))
++          if (old_ref == 2 && has_toggle_ref) /* The last ref being held in this case is owned by the toggle_ref */
+ 	    toggle_refs_notify (object, TRUE);
+-          
++
+ 	  return;
+ 	}
+       

Modified: projects/haf/trunk/glib/debian/patches/series
===================================================================
--- projects/haf/trunk/glib/debian/patches/series	2009-10-22 11:23:17 UTC (rev 19472)
+++ projects/haf/trunk/glib/debian/patches/series	2009-10-22 13:59:02 UTC (rev 19473)
@@ -1,5 +1,6 @@
 20-gmarkup-speedup.patch
 21-gsimpleasyncresult-memleak.patch
+22-g-object-unref-toggle-refs.patch
 25-gatomic.patch
 26-arm-stack-frames.patch
 30-gfileutils.patch

More information about the maemo-commits mailing list