[Spice-devel] [spice-gtk] Fix crash on remote-viewer startup with gthread coroutine
Christophe Fergeau
cfergeau at redhat.com
Fri Nov 15 03:07:15 PST 2013
g_object_notify_main_context() was recently changed to automatically
detect whether we are running in the main context or not, and SpiceSession
is now using g_object_notify_main_context().
In order to achieve that, IN_MAIN_CONTEXT is used, but it's not safe
to be used before coroutine_init() is called. IN_MAIN_CONTEXT expands to
(coroutine_self()->caller == NULL), but coroutine_self() will be NULL when
using gthreads for the coroutine implementation until coroutine_init() has
been called.
Before coroutine_init() has been called, we'll always be running in the
main context, so we can just add a check for coroutine_self() != NULL to
IN_MAIN_CONTEXT to solve that issue.
---
gtk/coroutine.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gtk/coroutine.h b/gtk/coroutine.h
index a9b3a87..7e3bc28 100644
--- a/gtk/coroutine.h
+++ b/gtk/coroutine.h
@@ -55,7 +55,7 @@ struct coroutine
#endif
};
-#define IN_MAIN_CONTEXT (coroutine_self()->caller == NULL)
+#define IN_MAIN_CONTEXT (coroutine_self() == NULL || coroutine_self()->caller == NULL)
int coroutine_init(struct coroutine *co);
int coroutine_release(struct coroutine *co);
--
1.8.4.2
More information about the Spice-devel
mailing list