$NetBSD: patch-ai,v 1.13 2007/01/10 14:57:33 drochner Exp $

--- glib/gmain.c.orig	2007-01-10 14:36:51.000000000 +0100
+++ glib/gmain.c
@@ -2619,13 +2619,13 @@ g_main_context_iterate (GMainContext *co
     {
       gboolean got_ownership;
       
+      LOCK_CONTEXT (context);
+
       g_return_val_if_fail (g_thread_supported (), FALSE);
 
       if (!block)
 	return FALSE;
 
-      LOCK_CONTEXT (context);
-      
       if (!context->cond)
 	context->cond = g_cond_new ();
           
@@ -2635,7 +2635,6 @@ g_main_context_iterate (GMainContext *co
 
       if (!got_ownership)
 	{
-	  UNLOCK_CONTEXT (context);
 	  return FALSE;
 	}
     }
