[Spice-devel] [spice-gtk] Don't set SpiceSession::cmain twice during migration

Christophe Fergeau cfergeau at redhat.com
Thu Jan 29 05:51:26 PST 2015


During migration, migrate_connect() ends with:
spice_session_set_main_channel(mig->session,
                               migrate_channel_connect(mig, SPICE_CHANNEL_MAIN, 0));

migrate_channel_connect() calls spice_channel_new() which will create a
new SpiceMainChannel instance.
spice_channel_constructed() will be called during this instanciation,
which will call spice_session_channel_new(), which will set
SpiceSession::cmain for SpiceMainChannel instances.

When calling spice_session_set_main_channel(), SpiceSession::cmain will
thus already be set, which causes a runtime warning as
spice_session_set_main_channel() has a precondition checking that
SpiceSession::cmain is not set already.

This commit removes the call to spice_session_set_main_channel() from
migrate_connect() as this call is not doing anything more than the call
to migrate_channel_connect().
---
 gtk/channel-main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 7af4a2e..82169aa 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -2132,8 +2132,7 @@ static gboolean migrate_connect(gpointer data)
 
     /* the migration process is in 2 steps, first the main channel and
        then the rest of the channels */
-    spice_session_set_main_channel(mig->session,
-                                   migrate_channel_connect(mig, SPICE_CHANNEL_MAIN, 0));
+    migrate_channel_connect(mig, SPICE_CHANNEL_MAIN, 0);
 
     return FALSE;
 }
-- 
2.1.0



More information about the Spice-devel mailing list