[glib/tls: 1/9] gmain: move finalization of GSource outside of context lock



commit b26bbb729654d3bd7c3f4f3d262018baaea61124
Author: Dan Winship <danw gnome org>
Date:   Sat Nov 6 09:35:25 2010 -0400

    gmain: move finalization of GSource outside of context lock
    
    This avoids ugly deadlock situations such as in
    https://bugzilla.gnome.org/show_bug.cgi?id=586432
    
    https://bugzilla.gnome.org/show_bug.cgi?id=626702

 glib/gmain.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/glib/gmain.c b/glib/gmain.c
index b182c66..301adb0 100644
--- a/glib/gmain.c
+++ b/glib/gmain.c
@@ -1520,7 +1520,13 @@ g_source_unref_internal (GSource      *source,
 	g_source_list_remove (source, context);
 
       if (source->source_funcs->finalize)
-	source->source_funcs->finalize (source);
+	{
+	  if (context)
+	    UNLOCK_CONTEXT (context);
+	  source->source_funcs->finalize (source);
+	  if (context)
+	    LOCK_CONTEXT (context);
+	}
 
       g_free (source->name);
       source->name = NULL;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]