--- glib-2.16.5.orig/gobject/gobject.c	2008-09-10 14:55:33.000000000 -0400
+++ glib-2.16.5/gobject/gobject.c	2008-09-10 14:58:00.000000000 -0400
@@ -1752,11 +1752,12 @@
   old_ref = g_atomic_int_get (&object->ref_count);
   if (old_ref > 1)
     {
+      gboolean toggle_ref = OBJECT_HAS_TOGGLE_REF (object); 
       if (!g_atomic_int_compare_and_exchange (&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 && toggle_ref)
 	toggle_refs_notify (object, TRUE);
     }
   else
@@ -1769,11 +1770,12 @@
       old_ref = g_atomic_int_get (&object->ref_count);
       if (old_ref > 1)
         {
+          gboolean toggle_ref = OBJECT_HAS_TOGGLE_REF (object);
           if (!g_atomic_int_compare_and_exchange (&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 && toggle_ref)
 	    toggle_refs_notify (object, TRUE);
           
 	  return;
