[Spice-devel] [PATCHv2 05/22] smartcard: do not initialize manager for migration session

Marc-André Lureau marcandre.lureau at redhat.com
Wed Nov 26 09:55:56 PST 2014


The migration session is temporary and shouldn't interact with system.
---
 gtk/channel-smartcard.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/gtk/channel-smartcard.c b/gtk/channel-smartcard.c
index d27360c..243a8ce 100644
--- a/gtk/channel-smartcard.c
+++ b/gtk/channel-smartcard.c
@@ -452,23 +452,24 @@ static void spice_smartcard_channel_up_cb(GObject *source_object,
                                           gpointer user_data)
 {
     SpiceChannel *channel = SPICE_CHANNEL(user_data);
+    GError *error = NULL;
 
     g_return_if_fail(channel != NULL);
     g_return_if_fail(SPICE_IS_SESSION(source_object));
 
-    if (!spice_channel_get_session(SPICE_CHANNEL(channel))->priv->migration_copy) {
-        GError *error = NULL;
+    spice_smartcard_manager_init_finish(SPICE_SESSION(source_object),
+                                        res, &error);
+    if (error)
+        g_warning("%s", error->message);
 
-        spice_smartcard_manager_init_finish(SPICE_SESSION(source_object),
-                                            res, &error);
-        if (error)
-            g_warning("%s", error->message);
-        g_clear_error(&error);
-    }
+    g_clear_error(&error);
 }
 
 static void spice_smartcard_channel_up(SpiceChannel *channel)
 {
+    if (spice_channel_get_session(SPICE_CHANNEL(channel))->priv->migration_copy)
+        return;
+
     spice_smartcard_manager_init_async(spice_channel_get_session(channel),
                                        g_cancellable_new(),
                                        spice_smartcard_channel_up_cb,
-- 
2.1.0



More information about the Spice-devel mailing list