[totem-pl-parser] Specify G_PRIORITY_DEFAULT for signal emission idle sources



commit 6792ae8958edd1b60ce5278e0a125974309ab904
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sat Oct 9 15:59:14 2010 +1000

    Specify G_PRIORITY_DEFAULT for signal emission idle sources
    
    This avoids the situation where the async ready callback is called first
    because it has higher priority.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=631727

 plparse/totem-pl-parser-private.h |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/plparse/totem-pl-parser-private.h b/plparse/totem-pl-parser-private.h
index 626e372..8e07260 100644
--- a/plparse/totem-pl-parser-private.h
+++ b/plparse/totem-pl-parser-private.h
@@ -41,15 +41,19 @@
  * thread to a stored GThread pointer known to be from the main thread
  * (TotemPlParser->priv->main_thread).
  *
+ * When using idle functions for async signal emission, we specify the same priority as
+ * GSimpleAsyncResult uses for its completion function (G_PRIORITY_DEFAULT). If the
+ * completion function has higher priority, the main loop will call it first.
+ *
  * @p: a #TotemPlParser
  * @c: callback (as if for g_idle_add())
  * @d: callback data
  */
-#define CALL_ASYNC(p, c, d) {				\
-	if (g_thread_self () == p->priv->main_thread)	\
-		c (d);					\
-	else						\
-		g_idle_add ((GSourceFunc) c, d);	\
+#define CALL_ASYNC(p, c, d) {							\
+	if (g_thread_self () == p->priv->main_thread)				\
+		c (d);								\
+	else									\
+		g_idle_add_full (G_PRIORITY_DEFAULT, (GSourceFunc) c, d, NULL);	\
 }
 
 #ifndef TOTEM_PL_PARSER_MINI



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