Never call vevent_get_next_vevent() before calling vcard_emul_init() Some mutexes are initialized in vevent_queue_init(), during emul_init() --- gtk/smartcard-manager.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/gtk/smartcard-manager.c b/gtk/smartcard-manager.c index ab3229f..51f228a 100644 --- a/gtk/smartcard-manager.c +++ b/gtk/smartcard-manager.c @@ -94,8 +94,6 @@ static guint signals[SPICE_SMARTCARD_MANAGER_LAST_SIGNAL]; #ifdef USE_SMARTCARD typedef gboolean (*SmartcardSourceFunc)(VEvent *event, gpointer user_data); -static guint smartcard_monitor_add(SmartcardSourceFunc callback, - gpointer user_data); static gboolean smartcard_monitor_dispatch(VEvent *event, gpointer user_data); #endif @@ -107,10 +105,6 @@ static void spice_smartcard_manager_init(SpiceSmartcardManager *smartcard_manage priv = SPICE_SMARTCARD_MANAGER_GET_PRIVATE(smartcard_manager); smartcard_manager->priv = priv; -#ifdef USE_SMARTCARD - priv->monitor_id = smartcard_monitor_add(smartcard_monitor_dispatch, - smartcard_manager); -#endif } static void spice_smartcard_manager_dispose(GObject *gobject) @@ -394,6 +388,18 @@ static guint smartcard_monitor_add(SmartcardSourceFunc callback, return id; } +static void +spice_smartcard_manager_update_monitor(void) +{ + SpiceSmartcardManager *self = spice_smartcard_manager_get(); + SpiceSmartcardManagerPrivate *priv = self->priv; + + if (priv->monitor_id != 0) + return; + + priv->monitor_id = smartcard_monitor_add(smartcard_monitor_dispatch, self); +} + #define SPICE_SOFTWARE_READER_NAME "Spice Software Smartcard" /** @@ -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; + + spice_smartcard_manager_update_monitor(); return TRUE; } -- 1.8.1.1.439.g50a6b54 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel