summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2013-11-15 12:01:45 +0100
committerChristophe Fergeau <cfergeau@redhat.com>2013-11-18 15:03:13 +0100
commit812c85b21bc1b9eeb0ff5c5659da53bc64786af0 (patch)
treec6b04c8a1b6d323075a4ac1fd38a35ce90e2d228
parenta9a2c162e0ee03f80e3e6f7450a002719a80d06a (diff)
Fix crash on remote-viewer startup with gthread coroutine
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.
-rw-r--r--gtk/coroutine.h2
1 files changed, 1 insertions, 1 deletions
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);