[Spice-devel] [PATCH spice-gtk] smartcard: do not register monitor before smartcard init

Christophe Fergeau cfergeau at redhat.com
Tue Feb 26 01:53:54 PST 2013


On Tue, Feb 26, 2013 at 01:36:23AM +0100, Marc-André Lureau wrote:
> Never call vevent_get_next_vevent() before calling vcard_emul_init()
> 
> Some mutexes are initialized in vevent_queue_init(), during emul_init()

A bit more details about what's going on in spice-gtk code could be nice
(the monitor is created in the instance _init function and calls
vevent_get_next_vevent() when a smartcard event occurs, but
vcard_emul_init() is only called asynchronously from a thread from
_init_async(), so this can be racy, this commit moves the monitor creation
after _init_async has completed).

>  /**
> @@ -512,17 +518,19 @@ gboolean spice_smartcard_manager_init_finish(SpiceSession *session,
>                                               GAsyncResult *result,
>                                               GError **err)
>  {
> +    GSimpleAsyncResult *simple;
> +
>      g_return_val_if_fail(SPICE_IS_SESSION(session), FALSE);
> -    g_return_val_if_fail(G_IS_ASYNC_RESULT(result), FALSE);
> +    g_return_val_if_fail(G_IS_SIMPLE_ASYNC_RESULT(result), FALSE);
>  
>      SPICE_DEBUG("smartcard_manager_finish");
>  
> -    if (G_IS_SIMPLE_ASYNC_RESULT(result)) {
> -        GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(result);
> -        g_warn_if_fail(g_simple_async_result_get_source_tag(simple) == spice_smartcard_manager_init);
> -        if (g_simple_async_result_propagate_error(simple, err))
> -            return FALSE;
> -    }
> +    simple = G_SIMPLE_ASYNC_RESULT(result);
> +    g_return_val_if_fail(g_simple_async_result_get_source_tag(simple) == spice_smartcard_manager_init, FALSE);
> +    if (g_simple_async_result_propagate_error(simple, err))
> +        return FALSE;
> +

This part looks like a code cleanup unrelated to this fix. Looks good
otherwise.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20130226/2c492293/attachment.pgp>


More information about the Spice-devel mailing list