--- glib/deprecated/gthread-deprecated.c.orig	2011-12-14 14:27:55.000000000 +0000
+++ glib/deprecated/gthread-deprecated.c	2012-03-09 11:51:08.328309671 +0000
@@ -807,12 +807,14 @@ g_static_rec_mutex_unlock_full (GStaticRecMutex *mutex)
 {
   GRecMutex *rm;
   gint depth;
+  gint i;
 
   rm = g_static_rec_mutex_get_rec_mutex_impl (mutex);
   depth = mutex->depth;
-  while (mutex->depth)
+  i = mutex->depth;
+  mutex->depth = 0;
+  while (i--)
     {
-      mutex->depth--;
       g_rec_mutex_unlock (rm);
     }
 
