[glib/tls: 2/7] gmain: fix some silly code in a programmer-error case



commit f60c45e10df5d17bcb2f43aa7342e1b4160c303c
Author: Dan Winship <danw gnome org>
Date:   Sat Nov 6 09:45:20 2010 -0400

    gmain: fix some silly code in a programmer-error case
    
    Previously if a source got finalized while still attached to a
    context, it would warn and re-ref the source. But then it just freed
    it anyway... So keep the warning but drop the re-ref.

 glib/gmain.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/glib/gmain.c b/glib/gmain.c
index 301adb0..05b0813 100644
--- a/glib/gmain.c
+++ b/glib/gmain.c
@@ -1511,13 +1511,12 @@ g_source_unref_internal (GSource      *source,
       source->callback_data = NULL;
       source->callback_funcs = NULL;
 
-      if (context && !SOURCE_DESTROYED (source))
+      if (context)
 	{
-	  g_warning (G_STRLOC ": ref_count == 0, but source is still attached to a context!");
-	  source->ref_count++;
+	  if (!SOURCE_DESTROYED (source))
+	    g_warning (G_STRLOC ": ref_count == 0, but source was still attached to a context!");
+	  g_source_list_remove (source, context);
 	}
-      else if (context)
-	g_source_list_remove (source, context);
 
       if (source->source_funcs->finalize)
 	{



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