[Spice-devel] [spice-gtk] Fix crash on remote-viewer startup with gthread coroutine

Marc-André Lureau marcandre.lureau at gmail.com
Fri Nov 15 04:20:32 PST 2013


ack

On Fri, Nov 15, 2013 at 12:07 PM, Christophe Fergeau
<cfergeau at redhat.com> wrote:
> 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
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel



-- 
Marc-André Lureau


More information about the Spice-devel mailing list